creating a Form from within a Form

G

Guest

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
 
G

Guest

Yes this works - I had confused Form2 as an instance rather than a class.

Thanks for the help,
ak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top