Reputation: 11
In my code i from form1 launch form2 using .Show()
.
Form2 f2 = new Form2();
f2.show();
block form1
until form2
close and when form2
closed continue my code.
Upvotes: 1
Views: 1440
Reputation: 13
I tested that ways and don't worked but only below code worked:
private void button1_Click_1(object sender, EventArgs e)
{
Form2 frm = new Form2();
this.Enabled = false;
frm.Show();
frm.FormClosing += new FormClosingEventHandler(frm_FormClosing);
frm.Show();
}
private void frm_FormClosing(object sender, FormClosingEventArgs e)
{
this.Enabled = true;
}
Upvotes: 0
Reputation: 550
.Show()
will show the new form you are displaying but it will enable you to go back and use the controls in the Main Form and .ShowDialog()
wont allow you to access your main form unless its closed.
f2.ShowDialog();
Upvotes: 4