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++ / May 2005

Tip: Looking for answers? Try searching our database.

Create an instance of a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tlemcenvisit - 27 May 2005 00:59 GMT
Hello
I'd like to create and affich an instance of the form "Form2" as a mdichild
of the actual form.
In C#.net, I know that is like this :

Form2 MyForm=new Form2();
MyForm.MdiParent=this;
MyForm.Show();

But I'd like to do it in C++.NET
I think that the first line is :

Form2 ^ MyForm=gcnew Form2();

please help me to complete this code
thanks
ismailp - 27 May 2005 01:51 GMT
I didn't use MDI child so far, in .NET, but let me give a shot.

Before my comment, please check your compiler; are you using C++/CLI
(Visual Studio 2005) or Managed Extensions for C++ (Visual Studio 2002,
Visual Studio 2003)?

If you are using C++/CLI, the above declaration of Form2 is fine.
Otherwise, for the latter case, you need to do this:

Form2* MyForm = new Form2();

The rest is almost identical to C# equivalent of the code, except those
dots (.) should be replaced with arrows (->).

MyForm->MdiParent = this;
MyForm->Show();

Ismail
tlemcenvisit - 27 May 2005 06:18 GMT
Hello
I use Visual C++.NET 2005 Beta2.
The project type is "CLR:Windows Forms Application"
When I use this code :

Form2* MyForm = new Form2();
MyForm->MdiParent = this;
MyForm->Show();

The compiler signals these errors :

error C2039: 'MdiParent' : is not a member of 'System::Enum'
error C2039: 'Show' : is not a member of 'System::Enum'

And when I use this code :

Form2^ MyForm = gcnew Form2();
MyForm->MdiParent = this;
MyForm->Show();

The compiler signals these errors :
error C2039: 'MdiParent' : is not a member of 'System::Windows::Forms::Form2'
error C2039: 'MdiParent' : is not a member of 'System::Windows::Forms::Form2'

Please help me
Marcus Heege - 30 May 2005 20:08 GMT
Are you sure you have derived Form2 from System::Windows::Forms::Form?

> Hello
> I use Visual C++.NET 2005 Beta2.
[quoted text clipped - 23 lines]
>
> Please help me
tlemcenvisit - 31 May 2005 05:57 GMT
I create form2 with designer as each form

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.