DEV Community

Muriithi Gakuru
Muriithi Gakuru

Posted on

1 1

BC30420 'Sub Main' was not found error in a Windows Form app: Quick Fix.

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.

Screenshot (46).png

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.

  1. All you have to do is right-click on your main project in the top-right area of the visual basic working area.

Screenshot (47).png

  1. Scroll to the bottom and click on properties.

Screenshot (48).png

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.
Screenshot (49).png
Once you're done, you can exit that tab and re-run your project.

Screenshot (51).png

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 !!

AWS Q Developer image

Your AI Code Assistant

Ask anything about your entire project, code and get answers and even architecture diagrams. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Start free in your IDE

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay