Click here to Skip to main content
15,888,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi guys,

i am fairly new to c++/cli programming. In my project i have a main form. when i click a button on it i hide this form and show other form. this is working fine. The code i used is

weatherfrm^ weather = gcnew weatherfrm();
this->Hide();
weather->ShowDialog();



now what i want to do is when i click the button on the second form i want to show the first form again and close this form. i am able to close the second form but i cant find a way to show the first form as i cannot create an instance veriable of first form on the second form. The reaon for this is that i include the second form weather.h in the frst one but now i cant do the same for the mainform as the files cannot include each other.


can someone plz help me.
Posted
Updated 19-Jul-10 2:47am
v2

1 solution

You show the second form using the method ShowDialog(), this call show the form and doesn't return until the form is closed. Then to show again the main form, you have to just add this->Show() on the line below:

C++
weatherfrm^ weather = gcnew weatherfrm();
this->Hide();
weather->ShowDialog();
this->Show();
 
Share this answer
 
Comments
Archman420 20-Jul-10 6:14am    
thanks a ton

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