Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2005

Tip: Looking for answers? Try searching our database.

creating a Form from within a Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AK - 07 Nov 2005 14:54 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.