Alxenen

Ok... I've been reading this forum for an houer now and i can't figure out to do this... I have created a new windows forms project in VC++... Then i added a second form (named Form2) and i added a button on each of the forms. The buttons are both named button1. What i want is when you click button1 on form1, form1 dissapares and form2 shows up and versa vi. The problem is only I need to know accactly what to post where... The files are named Form1.h, Form2.h and test1.cpp (there is also a Form2.cpp file and all the other files that is there when you start a new project). Pleas help.

Alxandr




Re: Windows Forms General Switching forms in Visual C++

Dav? S. A???????

Form ^s_form2 = gcnew Form2();
s_form2->Show();

this->Hide();





Re: Windows Forms General Switching forms in Visual C++

alxandr

In what file do I put that Inside an buttonevent in form1.h or in application.cpp Can i just double-click a button (in design mode) in form 1 and get a button-event. Than copy/paste that code into the buttonevent I've tryed so many things but non of them worked... And by the way, what code is to be changed in this code and what does need to stay like it is Can i change the s_form2 on both plases to for example testForm or does that need to stay... Som1 should make a tutor on this... It's giving me a headake... Can i type:

Form ^testForm = gcnew Form2();

testForm->Show();

 

Thnx 4 the help though...