准备工作:新建项添加from1&form2
1、双击Program.cs
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 A = new Form1();
if (A.ShowDialog() == DialogResult.OK)
{
Application.Run(new Form2());
}
}
2、Form1添加button双击绑定事件
private void button1_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
3、运行