If your project uses the "Enable application framework
" option, that would be one possibility why Sub Main
is not shown.
From https://visualstudiomagazine.com/articles/2007/10/01/enable-the-application-framework-in-vb.aspx
Q What happens when I check "Enable application framework" in my
Visual Basic application? Why does my Sub Main disappear from the
Startup Object dropdown...
A Visual Basic supports an "Application Framework" that makes it
easier to manage the startup, shutdown, and exception management of an
application. You enable or disable the application framework with a
check box in the Project Properties. ...
Whether or not you use the Application Framework, Visual Basic
generates a hidden My.Application class for your application. ...
The part of the My.Application class that you can't see includes a
shared Sub Main as the entry point of the application. ... The reason
Sub Main disappears from the startup combo box is that Visual Basic is
supplying Sub Main for you.
That's just a summary of the most relevant aspects for this question but the linked article also includes some other details explaining the application framework.
.DLL
) library Visual Studio will not allow the specification of a startup object. If this is the case, write a consuming object and refer to the library. – Shardasharepublic
, I needed the BLACK MAGIC trick of clean and re-build, and closing and re-opening the project in VS (also described below). – Blackman