I'm having a problem with c# when switching forms. It seems that when i switch from one form to the other they always call Form_load, which I don't want.
Im using form.show() and form.hide() so I don't understand why they are calling form_load.
This is the code:
from form1
private void btnModify_Click (object sender, EventArgs e)
{
Form mod = new modifyForm();
mod.Show();
this.Hide();
}//end btnModify_Click
from modifyForm:
private void btnCancel_Click (object sender, EventArgs e)
{
Form toMain = new Form1();
this.Close();
toMain.Show();
}
I'm just hiding and showing Form1 but it calls Form1_Load each time.
Can I get around this? I've tried using form.visible=tr ue and form.visible=fa lse but the result is the same.
Im using form.show() and form.hide() so I don't understand why they are calling form_load.
This is the code:
from form1
private void btnModify_Click (object sender, EventArgs e)
{
Form mod = new modifyForm();
mod.Show();
this.Hide();
}//end btnModify_Click
from modifyForm:
private void btnCancel_Click (object sender, EventArgs e)
{
Form toMain = new Form1();
this.Close();
toMain.Show();
}
I'm just hiding and showing Form1 but it calls Form1_Load each time.
Can I get around this? I've tried using form.visible=tr ue and form.visible=fa lse but the result is the same.
Comment