tags:

views:

91

answers:

3

i am trying to go from one form application to the next by clicking a button, how do i do it?

+3  A: 

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.

dcp
here is the info private void button3_Click(object sender, EventArgs e) { ReservationPage f2 = new ReservationPage(); f2.Show(); }
James
it did not work
James
Maybe I didn't understand your question, can you clarify what is meant by "move from one form application to the next"?
dcp
+2  A: 

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.

Dawood Moazzem
A: 

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(); }

scatterbraiin