showing form 2

Started by
9 comments, last by traxxas25 20 years, 4 months ago
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
Advertisement
please guys i really need some help on thio, all help is appreciated, thanks!
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..
hmmm possibal i can get a sample code, im having trouble implementing it into my own project
I start to suspect that it''s a homework a question...

deepdene has provided enough information for you to start with.

So let me rephrase it:
1. Create an instance of form 2.
2. .Show()
yeah but i may sound like a complete moron what exactly is an instance?
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

Niko Suni

lol not really no? can i get a sample of an instance? not the form in particualr but just a sample
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]

Niko Suni

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

This topic is closed to new replies.

Advertisement