REALLY Easy Way Place a button on form 1 In the click event put the code m_Form2.Controls.Add(this.button1);
Done Next
Place a public method on form 2 something like this
public void InsertControl(Control c) { this.Controls.Add(c); c.Visible = true; }
then on form 1 place a button. On the click event of the button put the code.
m_Form2.InsertControl(this.button1);
the button shoots to form 2 and is gone from form 1. Probably missing some cleanup, but you get the picture. The second could be useful to send anything to form 2.
How do i pass control to another form in a button click event
How do i pass control to another form in a button click event
Kwen.de.Mike
Example:
public void HandleClick(object sender, EventArgs e)
{
Form2 f = new Form2();
f.Show();
}
Hope this helps.
-Ari
J4m3sB
Gurunath
How can I make form2 open in the same location as form1 and form1 dissapear.
So eg like what you see in a nomal app setup. Enter data on one form click next and then another form opens so you can enter data in and then so on.
JasonMcC
REALLY Easy Way
Place a button on form 1
In the click event put the code
m_Form2.Controls.Add(this.button1);
Done
Next
Place a public method on form 2 something like this
public void InsertControl(Control c)
{
this.Controls.Add(c);
c.Visible = true;
}
then on form 1 place a button.
On the click event of the button put the code.
m_Form2.InsertControl(this.button1);
the button shoots to form 2 and is gone from form 1. Probably missing some cleanup, but you get the picture. The second could be useful to send anything to form 2.