473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Create an instance of a form

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
Nov 17 '05 #1
4 1736
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

Nov 17 '05 #2
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
Nov 17 '05 #3
Are you sure you have derived Form2 from System::Windows::Forms::Form?
"tlemcenvisit" <tl**********@discussions.microsoft.com> wrote in message
news:09**********************************@microsof t.com...
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

Nov 17 '05 #4
I create form2 with designer as each form
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
0
by: Nate | last post by:
Hi All, I am having difficulty creating a new instance of a proxy for an XML Web Service in my Web Form Client (VB) .NET code. When I try to run my 'hello world' file, hw.aspx, I receive the...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
6
by: Rene Mansveld | last post by:
Hi, how can I create an instance (object) of a class (form) if I only know the classname (VB.NET 1.0)? I need to do this in a complex app where jobs consist of parts. Each part's data is saved...
6
by: wu jianhua | last post by:
hi. If I have a form, like FrmAbout, can I create a form instance only with a string "FrmAbout"? not like : Form frm = new FrmAbout(); I want the code : Form frm = createInstance( "FrmAbout" );...
5
by: tarnap | last post by:
Hello, I have an instance of a form, lets say formA. This form is passed to a method that must create a new form, lets say formB of the same type. How can this be accomplished except by using...
24
by: M O J O | last post by:
Hi, Instead of doing this.... Public Class Form1 Public Shared Sub CreateAndShow() Dim f As New Form1 f.Show() End Sub
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
6
by: Savante | last post by:
I have been writing a datalogging application. It reads in double's into a database. I want to be able to click on a row in a database (holds name of variable and also current value of variable)...
14
RMWChaos
by: RMWChaos | last post by:
Firebug is reporting "too much recursion" when I attempt to create a child element in a parent that doesn't exist yet. The script should automatically create the missing parent before going on to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.