i am trying to go from one form application to the next by clicking a button, how do i do it?
I assume by "go from one form application to the next" you mean you want to invoke another executable (another windows forms app, for example). If that assumption is correct, then you can wire up the OnClick
method of the button to do something like this:
System.Diagnostics.Process.Start(@"C:\your_other_app.exe");
You can refer to this msdn link for more info about Process.Start and its different variations.
Try this:
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show() ;
}
and make sure that button1's click event is handled:
this.button1.Click += new System.EventHandler(this.button1_Click);
or
button1.Click += this.button1_Click;
either in the designer code, or in your Form.load handler, or your form constructor.
You have to make in buttonClick SecondForm's object and then object.ShowDialog() or Show, if you want your second form to be active and not to have right to move to first Form, then use ShowDialog method, other way use Show(). Like this :
private void Button_Click(object sender, EvantArgs e)
{
SecondForm form = new SecondForm();
form.ShowDialog(); //form.Show();
}