As Steven's answer says, by default you don't need anything like Program.cs
in a VB.NET application. If you want to replace the standard launch code, however, you can add a new module and select it as the startup object.
First, right click on the project and choose Add: Module.... You can name the module anything you like, but I named it Program.vb to be consistent with the C# default. Paste in the following code:
Module Program
Public Sub Main()
Application.Run(New Form1()) ''//Use your main form here
End Sub
End Module
Next, right click on the project and choose Properties. On the Application tab, uncheck "Enable application framework". Then change the startup object to Program. There's another option called Sub Main that I think will run the Main()
subroutine wherever it is.
Now that you've replaced the standard launch code, you can add other things to your Main()
subroutine. I noticed one other thing on MSDN (How to: Change the Startup Object for an Application):
When using a custom Sub Main procedure as the Startup object, code in the application events (Startup
, Shutdown
, StartupNextInstance
, and UnhandledException
) is not executed.