Archived

This topic is now archived and is closed to further replies.

showing form 2

This topic is 5111 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey guys!, im alittle confused with how to show a new form i have in my project (called form2.h) the code would go here: private: System::Void button10_Click(System::Object * sender, System::EventArgs * e) { //code goes here } all help would be appreciated, thanks for all your help guys! btw im using Visual C++ .NET 2003

Share this post


Link to post
Share on other sites
I take it you got a managed c++ winforms project. To show a form under .net managed code, there is a .Show() or .ShowModal() method that will present the form. Modal meaning it''s above all other froms, Show just meaning the other windows can come into focus as well.. You may have to create an instance of form2..

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
yeah but i may sound like a complete moron what exactly is an instance?


A manifestation of a class. Once you have defined a class prototype, you can (usually) create some instances of that class.

A form is a type of class; the main form that gets shown is an instance of a main form prototype... get the drift?

Kind rgds,
-Nik

Share this post


Link to post
Share on other sites
In the default application, an instance of the form1 is created:

new Form1()

On the same line, it is used as a parameter to the Application.Run function, but you could call it's methods by storing the Form1 instance as it's own variable.
For example:

Form1 *pForm = new Form1();
pForm->Show();

Now, nothing stops you from creating an instance of a Form2 class?

This is very basic OOP, i suggest you read about basic programming some more. No offense, we've all been newbies

Kind rgds,
-Nik

[edited by - Nik02 on December 14, 2003 6:14:14 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
yes but form2 isnt going to be made manualy its premade as a header file (form2.h) it was made like designing a form in VB

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
yes but form2 isnt going to be made manualy its premade as a header file (form2.h) it was made like designing a form in VB


Therefore you should already have a Form2 prototype specified.
Now, all you really need to do is to make an instance of it, and show it.

-Nik

Share this post


Link to post
Share on other sites