BC30420 'Sub Main' was not found error in a Windows Form app: Quick Fix.
Programming Visual Basic
It's safe to say that Visual Basic has become one of the hardest languages to find content about online ever since Microsoft announced that there won't be any more features added to it in .NET CORE/ .NET 5.
“ Going forward, we do not plan to evolve Visual Basic as a language ”
.NET Team
That explained a lot when I tried to troubleshoot an error I'd gotten and the whole of the internet was almost blank, for an error I'd call trivial and noob level. I've recreated the above error so as to show you how to solve it. Save you time.
Every time I tried the compile and run the project, i got and error that the
Sub Main()
was not found. The solution to this is to check that the startup form isn't referencing to an old method. You can find that in your project properties.
- All you have to do is right-click on your main project in the top-right area of the visual basic working area.
- Scroll to the bottom and click on properties.
On the new window right at the Startup Project section is where you're going to change from Sub Main
to the name of your Form. Once you're done, you can exit that tab and re-run your project.
Everything should be working fine and you can notice that the error is gone.
Conclusion
Every day is a coding challenge. If you feel that the content was inadequate please comment about it or contact me. Keep coding.
Cheers !!