954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

multiform windows appliction in VB . NET

I'm trying to build a windows app with multiple forms. in project explorer i'm right clicking the current project, add->add existing item. then I select a form, but now the project won't build. I get these errors:

'Form1' is ambiguous in the namespace 'WindowsApplication1'.

'Sub Main' was not found in 'WindowsApplication1.Form1'.

Resources 'Form1.resx' and 'MathCalculator.resx' have the same manifest resource name 'WindowsApplication1.Form1.resources'.


am I not adding forms to my project correctly?

bigpoppapumpg
Light Poster
26 posts since Oct 2003
Reputation Points: 12
Solved Threads: 0
 

Try clicking Project > Add Form > New > Form > Open

Roberdin
Supreme Evil Overlord
Team Colleague
282 posts since Feb 2003
Reputation Points: 63
Solved Threads: 6
 

Your problem is that the form you are adding is named "Form1" and you already have a form named "Form1".

Change the class definition for one of the forums to "Form2" or anything else you would like.

To open a form from a button on another form, this is the code:

'Assuming that the form you want to call is named Form2
Dim a as new Form2
a.Show()




I'm pretty sure the above is right.. I'm spending to much time on ASP.NET Development, and C# Windows Form development ::blushes::

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

what is strange is I have renamed the forms in solution explorer, but when i go back to the code window it still says 'form1'. so basically if I want to call form 'a' from form 'b', I just add form 'a' to form 'b' and use the show method?

bigpoppapumpg
Light Poster
26 posts since Oct 2003
Reputation Points: 12
Solved Threads: 0
 

When you rename the form, you also need to change the class name in the .vb file.

Tekmaven
Software Architect
Moderator
1,274 posts since Feb 2002
Reputation Points: 322
Solved Threads: 28
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You