如何从对话框结果中打开新表格| C#

问题描述 投票:0回答:1

我在OnChanged()中使用对话框结果,(FileSystemWatcher)如下:

if (dialogResult == DialogResult.Yes)
                {
                    new Form2().Show();      
                }

但是当我单击“是”按钮时,新表格被挂起(未响应),请告知。

c# winforms visual-studio-2012
1个回答
0
投票

完成是这样的:

var frm = new Form2()
if (frm.ShowDialog()==DialogResult.Yes)
{
 //write your code here
}

0
投票
Form2 frm=new Form2;
frm.Show();
frm.Hide();
 if (dialogResult == DialogResult.Yes)
 {
// For calling a GUI For inside thread On FileSystemWatcher using Invoke

frm.Invoke((MethodInvoker)delegate {
frm.Show();
 });
© www.soinside.com 2019 - 2024. All rights reserved.