How can I get my VB.NET forms application startup method to be Sub Main() in Program.vb?
Trying to get it to behave like C#, where there is a Program class with a static Main method.开发者_开发问答
However, in the project properties, I cannot set Program.vb to be the startup object, only the forms (it is a forms application).
Am I missing something?
I am using the VS2010 and the latest VB.
Uncheck Enable Application Framework
in Project Properties.
You need to switch off “Application Framework” on the main page of the project settings.
The application framework provides its own entry point which sets up a few things that are subsequently used (e.g. application events, single instance checks etc.) and then just displays the main form using System.Windows.Forms.Application.Run
. That’s why you can only supply the main form, not a custom entry point method.
精彩评论