Windows Develop Bookmark and Share   
 index > Windows Forms General > using another form
 

using another form

In my recent project I have started out with a form, and later I added another form to be used for some side-functions. The questions goes: How do I make it so, that it is this new form, that opens.

Example: The forms name is: Calc. And so I write:

Code Snippet

Form Calc = new Calc();

Calc.Show();

But it only show a new form I've never seen before nor have I ever made it in the project. Help!

Mr.H  Saturday, March 15, 2008 12:56 PM

You want an instance of the Calc form, not an instance of the Systems.Windows.Forms.Form:

Calc C = new Calc();

C.Show();

JohnWein  Saturday, March 15, 2008 1:55 PM
as said, it seems you mistyped the variable declaration and created a Systems.Windows.Forms.Form form insead of your custom form Calc.
MEYWD  Saturday, March 15, 2008 3:46 PM

You want an instance of the Calc form, not an instance of the Systems.Windows.Forms.Form:

Calc C = new Calc();

C.Show();

JohnWein  Saturday, March 15, 2008 1:55 PM
as said, it seems you mistyped the variable declaration and created a Systems.Windows.Forms.Form form insead of your custom form Calc.
MEYWD  Saturday, March 15, 2008 3:46 PM

Ah okay.

Thanks for the help. It was driving me crazy.

Mr.H  Sunday, March 16, 2008 4:20 PM

You can use google to search for other answers

Custom Search

More Threads

• sizeof kinda thing?
• How to use System.Windows.Controls.Image control for HD Photo?
• Transparent label Control in VB 2005
• Eliminating MDI parent form scrollbars?
• ListView DoubleClick
• monthCalendar
• Tree View+Table
• Can I work on .NET 2.0 with VS2003?
• .Net equivalent MSscript control
• mmc and c#