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等),
{
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等),
解决方案 »
- 为什么datagridview绑定datareader显示的数据不完整?
- 一个SQLSERVER数据库太大而且正在使用中,我想研究它的结构,如何复制它一个不包含记录的空数据库?
- 请教:我用C#来访问Access数据库,突然变成800兆了,请问有哪些因素造成的阿?
- 给IIS建个虚拟目录出错???怎么才对呀
- 急!!!!如何在删除dataset中的记录时把数据库中对应的记录同时删除啊
- 程序启动:“ResolveAssemblyReference”任务意外失败,System.IO.IOException: 没有更多文件...... 请高手解决,急盼!
- XML的简单问题
- windows 7 触摸屏问题
- c#GZIP解压java压缩的GZIP
- winform程序如何将DataTable数据导入到Excel文件中
- 查询语句书写格式(c#)
- 修改密码的问题
说说解决方法
从上面的代码可以看出:就是弹出一个对话框,对话框显示正在处理的信息,并在显示过程中运行其下在的代码,这里是PostConfig pc = new PostConfig(textBoxURL.Text, textBoxUserName.Text,textBoxPassword.Text); 因为f.Show(this);加了参数this,所以所有者还是本窗口,那么PostConfig pc = new PostConfig(textBoxURL.Text, textBoxUserName.Text,textBoxPassword.Text)还是执行的。但就是影响了Form f = new Form()的响应。
f.Show(this)的话,程序“所有者”还是在this,可以运行f,也可以运行this窗口