Click here to Skip to main content
15,921,697 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have 2 form in c#
i want to move from form1 to form 2
so i write the following in the form1:
Form2 form2=new Form2();
form2.show();

what i need is how to return to form1 without building new one
i want to go back to the same first form1
how can i do this?
Posted
Comments
Sergey Alexandrovich Kryukov 7-Nov-13 13:32pm    
Move what?! :-)
What do you mean by "building" a form?
What do you mean by "returning" to a form?
—SA
Member 10220821 7-Nov-13 14:46pm    
i mean by building this code:
form f=new form();
Sergey Alexandrovich Kryukov 7-Nov-13 15:09pm    
If you mean construction, call it construction (and that won't compile; remember that C# is case-sensitive).
Anyway, see my answer. Is it what you need?
—SA

1 solution

Please see my comment to the question: apparently, the question is not correctly formulated. But most likely, you are looking for this:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.activate%28v=vs.110%29.aspx[^].

Want an advice? Avoid using more then one form in your application. Make one form and change it content by having different panels with different controls; you would need to show and hide panels depending on the state. Another good option is to use, instead of multiple forms, different tab pages using System.Windows.Forms.TabControl.

—SA
 
Share this answer
 

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