首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

在方法内建Form,响应不行.该如何解决

2012-01-16 
在方法内建Form,响应不行...........privatevoidPostFireWallAddButton_Click(objectsender,EventArgse){X

在方法内建Form,响应不行...........
private   void   PostFireWallAddButton_Click(object   sender,   EventArgs   e)
                {
                        XmlManage   xm   =   new   XmlManage(XmlManage.PostConfigXmlFile);
                     
                        Form   f   =   new   Form();
                        Label   fl=new   Label();
                        fl.Text= "正在验证数据是否有效,请稍后... ";
                        fl.Font   =   new   Font( "宋体 ",   12);
                        fl.Width   =   280;
                        fl.Location=new   Point(50,50);
                        f.FormBorderStyle   =   FormBorderStyle.FixedDialog;
                        f.MaximizeBox   =   false;
                        f.MinimizeBox   =   false;
                        f.Controls.Add(fl);
                        f.Size   =   new   Size(300,   130);
                        f.StartPosition   =   FormStartPosition.CenterParent;
                        f.ShowInTaskbar   =   false;
                        f.ResumeLayout(true);
                        f.Show(this);
                     
                        PostConfig   pc   =   new   PostConfig(textBoxURL.Text,   textBoxUserName.Text,   textBoxPassword.Text);
                        pc.login();
                     
                        if   (!pc.IsValid)
                        {
                                //MessageBox.Show( "您的输入无效,请重新输入! ");
                                fl.Text= "您的输入无效,请重新输入! ";
                                return;
                        }
                        fl.Text   =   "验证数据有效,正在退出验证... ";


                        f.Dispose();


运行时,f窗口响应不了,又不是完全不响应......
也就是,不能在   f.Show(this)后面调用其它方法(这时是调用PostConfig等),

[解决办法]
学习
[解决办法]
看看愚翁大哥的文章:

http://blog.csdn.net/knight94/archive/2006/05/27/757351.aspx

热点排行