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

thanks, Wes Aday and Mali_S!

a right way for calling Form2 is:
C#
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                 
                 Form^frm=gcnew Form2();
                 frm->Show(); //Attention: ShowDialog() not the same result
                 Form1::Hide();


}
Of course i've written this above in Form1.h:
C#
#pragma once
#include "Form2.h"


my advanced question is, how can i make this:
Form1 Button_Click->Form2, Form2 Exit->Form1 again!

how can i code the "Quit" top right of the windows??



Thx!
Posted
Updated 20-Aug-12 19:50pm
v4
Comments
[no name] 20-Aug-12 9:16am    
You want to hide the form 1 not close it.
christmars 20-Aug-12 9:58am    
But with "Hide();" there is nothing anymore. Both Form1 and 2 are hidden. I can't see Form2 either...
[no name] 20-Aug-12 11:02am    
Form^frm=gcnew Form2(); frm->Show(); Form1::Hide();
christmars 21-Aug-12 1:40am    
Thank you!! it makes sense! what i wrote was Showdialog(), there must have difference.
Can you please tell me, how can i get Form1 again after i close Form2?
[no name] 21-Aug-12 7:25am    
Form1::Show()

1 solution

Instead of closing form1, Hide it. After being done with Form2, close the form1 and exit the function.
 
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