470,850 Members | 988 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

sub main was not found - solution for complete noobs

I downloaded VB.NET for the first time and chose to start a project based on Windows Forms for VB.
It opened a new project with a default Form1 for me. I tried to run it expecting to see a blank form show but instead I got the rror message "sub main was not found".
After searching wrong answers for ages I found out that it's due to 2 set up errors by Microsoft (surprise, surprise).
The first error is that when you click the green arrow to Run your project, THE DEFAULT thing to run is a Subroutine called Main. If that isn't found, it doesn't say, "I don't know what to run".
The second error is that it does not specify that the Form is the default thing to run.
To fix that you need to right-click your Solution (Project) and choose Properties.
In the new window that opens, click Application, then the listbox Startup Object and click your form name e.g. Form1
Now it will work.

May 11 '21 #1
0 2890

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Sven Putze | last post: by
4 posts views Thread by james margey | last post: by
2 posts views Thread by Erwin Moller | last post: by
1 post views Thread by Carl Dreher | last post: by
reply views Thread by Gerrit Horeis | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.