|
 |
csharptoday_discuss thread: How2 add a form to project and call it from main form (reworded)
Message #1 by "L. Roovario" <lroov@h...> on Fri, 7 Dec 2001 20:09:25
|
|
Dear Friends,
I have a C# windows application.
Using the IDE I created Form1 with a bunch of controls. It works great.
Using the IDE, I want to add a second form (Form2) and open it with a
button on Form1.
How do I add the second form?
Add a new Windows form to the solution?
Add a new Class?
Type the code in myself somewhere (where would you put it anyway)
I'm trying desperately to have the IDE do a lot of the work for me.
Unfortunately, none of the $275.00 worth of C# books I bought so far show
you how to do much via the IDE.
Thanks again
-Larry
Message #2 by "Todd Bryant" <Todd.Bryant@n...> on Fri, 7 Dec 2001 12:47:02 -0800
|
|
Larry,
All you must do is create another windows form using the IDE.
That form is now a class that is accessable from the first form
Use it like the example below.
<Snippet>
//Form Declaration
Form2 myForm;
//Form instantiation
myForm =3D new Form2();
//Show Form
myForm.Show();
</>Snipper
Todd Bryant
Netdesk Corporation
xxx.xxx.xxxx FAX xxx.xxx.xxxx
e-mail: Todd.Bryant@n...
Get Ready for .NET at http://www.netdesk.com/nettraining
-----Original Message-----
From: L. Roovario [mailto:lroov@h...]
Sent: Friday, December 07, 2001 12:09 PM
To: C#Today Discuss
Subject: [csharptoday_discuss] How2 add a form to project and call it
from main form (reworded)
Dear Friends,
I have a C# windows application.
Using the IDE I created Form1 with a bunch of controls. It works great.
Using the IDE, I want to add a second form (Form2) and open it with a
button on Form1.
How do I add the second form?
Add a new Windows form to the solution?
Add a new Class?
Type the code in myself somewhere (where would you put it anyway)
I'm trying desperately to have the IDE do a lot of the work for me.
Unfortunately, none of the $275.00 worth of C# books I bought so far
show
you how to do much via the IDE.
Thanks again
-Larry
Todd.Bryant@n...
$subst('Email.Unsub')
Message #3 by "Gerald Leslie" <leslie@a...> on Mon, 10 Dec 2001 10:08:37
|
|
hi,
To add a new form to your project through IDE, what you have to do is,
in the solution explorer just right click. In the menu you select Add, in
the second menu you select "Add Windows form". This will add a new form to
your project. Now you select the added form and get the properties window.
In the properties window there will be one field called ID. This will give
you the instance of the newly added form. Let the ID of the new form is
form1. Now if you wanna call the newly added form from the first form on
the click event of the button you just write
form1.show();
This will show you the new form.
Hope this will help you
leslie
|
 |