|
-
December 11th, 2002, 09:24 AM
#1
compile error from the start?
I have just started trying to learn VB .Net. I created a new windows application project that consists of nothing but an empty form. When I try to run the form I get the following compile error:
'Sub Main' not found in TestApp.Form1.
I looked in my book for any clues and noticed that a console application contains code in the Sub Main routine. Is the project I created somehow having an identity crisis? How can I fix this?
Please help...
-
December 11th, 2002, 09:32 AM
#2
Two Questions:
1) EXACTLY how did you create the app?
2) What is your startup set to in the project properties?
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 11th, 2002, 10:43 AM
#3
sub main is the first form that is opened when you run an application, what you did was change that form name from form1 to something else and it's still looking for form1 as the first form to open. so you have to set your "new name" to be the sub main form. it's easier to always name your form before they are created that way you don't have to change things later, so when you are adding a form, and you get the dialog box to add the form, change formX.vb to what you want the form to be named then you won't have to worry about changing "stuff" when you rename it.
Last edited by Jym; December 11th, 2002 at 10:48 AM.
-
December 11th, 2002, 01:15 PM
#4
To answer CPUWizard's questions -
1. I opened Microsoft Visual Studio .Net. Then from the start page I chose new project and selected VB .net Windows App.
2. I deleted my first attempt. When I did it the second time WITHOUT renaming the Form, I noticed that under project properties, the startup object was configured as Form1 - not Sub Main.
I ran the empty windows app successfully this time.
Thanks for the quick response!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|