Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am creating me windows application. Here I have some forms. I want to navigate to the the second form from first form. I already designed both forms. Could you please give me the idea to move from first form to second?
Thank you...
Posted
Updated 24-Feb-18 7:32am
v2

Close the current form - this.Close(),
Create object for another form and call formObject.Show() method.

Like this:
C#
private void button1_Click_1(object sender, EventArgs e)
     {
        Form2 obj = new Form2();
        if (obj == null)
        {
            obj.Parent = this;
        }
            obj.Show();
            this.Hide();
     }


..also try here[^]
and a example Navigating from one form to another[^]
 
Share this answer
 
v2
Comments
Neha Thanka 27-Jul-12 8:46am    
Thank you..
But I have to redirect to already created form.
Prasad_Kulkarni 27-Jul-12 8:48am    
What does that mean??

the code which I have provided will redirect you to already created form.
Form2 obj = new Form2(); creates object of that form and obj.show() displays your second form.
Neha Thanka 27-Jul-12 8:53am    
Thank you....
Prasad_Kulkarni 27-Jul-12 8:54am    
Hope it solved your question!
You're welcome.
Hello Neha,

Please have a look at following links:
Redirect from one form to another form[^]
 
Share this answer
 
Comments
Neha Thanka 27-Jul-12 8:46am    
Thank you....
But I have to redirect to already created form...
Vani Kulkarni 27-Jul-12 8:49am    
Ok create an object of your already created form and call the Show() method. Your issue will be resolved.
this.Hide();
Form2 f2 = new Form2;
f2.Show();
Neha Thanka 27-Jul-12 8:53am    
Thank you....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900