J
jjeffers1
Hello - I am an experienced web programmer who is new to windows forms
programming.
The problem I am facing is passing control in a winforms app from one
form to another. Essentially I have form1, which has some text fields,
and upon submittal of those fields using a button click, I want to save
those and open a new form called form2. I instantiate form2 in the
button click event handler of form1 by using:
Form Form2 = new Form();
Form2.Activate();
Form2.Visible = true;
This works fine as it displays form2. However if I close form1 manually
or using:
this.Close();
in the same button click event handler after the previous code snippet
it closes the whole application. That leads me to believe that form1
remains the "ActiveForm". How do I make form2 the active form after the
submit event?
Thanks for any help.
programming.
The problem I am facing is passing control in a winforms app from one
form to another. Essentially I have form1, which has some text fields,
and upon submittal of those fields using a button click, I want to save
those and open a new form called form2. I instantiate form2 in the
button click event handler of form1 by using:
Form Form2 = new Form();
Form2.Activate();
Form2.Visible = true;
This works fine as it displays form2. However if I close form1 manually
or using:
this.Close();
in the same button click event handler after the previous code snippet
it closes the whole application. That leads me to believe that form1
remains the "ActiveForm". How do I make form2 the active form after the
submit event?
Thanks for any help.