当前位置:编程学习 > C#/ASP.NET >>

自动生成SERVER CONTROLS在程序里的应用

答案:        private string listFolder(EASYMAILIMAP4Lib.EasyMailIMAP4 IMAP4,string strFolder,int perpage)
        {
            TableRow r;
            TableCell c;
            int x,pages,pgnum,start,end;
            string str1;

            x = IMAP4.SelectMailbox(strFolder);
            if(x != 0)
            {
                IMAP4.CreateMailbox(strFolder);
                return "(Created!)";
            }
            else
            {   

                r = new TableRow();
                c = new TableCell();            
                str1 = "当前邮箱 "+strFolder+" ";
                str1 = str1+"共有邮件 "+IMAP4.MessageCount+" 封";
                Folder_Info.Text = str1;

                if(IMAP4.MessageCount==0)
                {
                  return "No Message";
                }

                if((IMAP4.MessageCount%perpage) ==0 )
                {
                    pages=IMAP4.MessageCount/perpage;
                }
                else
                {
                    pages=(int)IMAP4.MessageCount/perpage+1;
                }

                pgnum=1;
                try
                {
                    pgnum=Convert.ToInt32(Request.QueryString["pg"].ToString());     
                }
                catch
                {
                    pgnum=1;
                }

                
                if(pgnum>1)
                {
                    end=pgnum*perpage;
                    start=end-perpage+1;
                }
                else
                {
                    end=perpage;
                    start=1;
                }


                x = IMAP4.DownloadEnvelopes(start, end, 0);
                
                if(x != 0)
                {
                    return "(Error:"+x+")";
                }

                r = new TableRow();

                c = new TableCell();
                c.Controls.Add(new LiteralControl(""));
                c.Width=15;
                r.Cells.Add(c);

                c = new TableCell();
                c.Controls.Add(new LiteralControl(""));
                c.Width=15;
                r.Cells.Add(c);

                c = new TableCell();
              

上一个:如何在vs.net中利用UML来建模(转自MSDN)
下一个:资源文件说明:使用资源(续)

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,