EDN Admin
Well-known member
Im trynig to switch back and forth between 2 forms using form.show() and form.hide() but it keeps calling Form_load for some reason.
this is the code:
<b>From Form1:</b>
private void btnModify_Click(object sender, EventArgs e)
{
modifyForm mod = new modifyForm();
mod.Show();
this.Hide();
}//end btnModify_Click
<b>From modifyForm:</b>
private void btnCancel_Click(object sender, EventArgs e)
{
Form1 toMain=new Form1();
this.Close();
toMain.Show();
}
I have a feeling its because of <i>Form1 toMain=new Form1();. It seems to open a whole new form1 and as a result calls form1_load. How can I get around this? I just want to go back to the form i hid.
</i>
View the full article
this is the code:
<b>From Form1:</b>
private void btnModify_Click(object sender, EventArgs e)
{
modifyForm mod = new modifyForm();
mod.Show();
this.Hide();
}//end btnModify_Click
<b>From modifyForm:</b>
private void btnCancel_Click(object sender, EventArgs e)
{
Form1 toMain=new Form1();
this.Close();
toMain.Show();
}
I have a feeling its because of <i>Form1 toMain=new Form1();. It seems to open a whole new form1 and as a result calls form1_load. How can I get around this? I just want to go back to the form i hid.
</i>
View the full article