I have a Windows Forms .NET application. I need tolaunch an entire new
Windows Form2 (with its' own designer Form2.h [Design]) off of a button click
event handler from Form1. How can I do this ?
I think part of the answer invloves going to my project & doing :
Add > New Item > Windows Form
This adds the Form2.cpp & Form2.h & Form2.h [Design].
But I'm not sure on what to add in the Form1.h button click event handler.
Here's what I've tried :
System::Windows::Forms::Form* Form2 = new System::Windows::Forms::Form();
Form2->Show();
This does launch a new window, but it's not the Form2 I created in
[Designer] - in effect, I've created two Form2's ...
Should I use :
Application::Run (new Form2()); ??
Any help would be appreciated - I'm stuck on this issue.
I can send the source code if it would help.
Regards,
ak
Tamas Demjen - 07 Nov 2005 18:29 GMT
> System::Windows::Forms::Form* Form2 = new System::Windows::Forms::Form();
> Form2->Show();
Form2* form2 = new Form2;
form2->Show();
Tom
AK - 07 Nov 2005 22:31 GMT
Yes this works - I had confused Form2 as an instance rather than a class.
Thanks for the help,
ak
> > System::Windows::Forms::Form* Form2 = new System::Windows::Forms::Form();
> > Form2->Show();
[quoted text clipped - 3 lines]
>
> Tom