Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.Net 2022 Community Edition - Sub Main Not Listed as Startup Object 1

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
0
36
US
Cannot change startup from Form to Sub Main
Windows Form App
Application Framework is not checked.
Only forms are listed under startup object
Code:
Module MainProc
...
   Public Sub Main()
      ' Do stuff here before launching main form
   End Sub
End Module
I have MainProc.vb in a folder under the project
I've updated VS and restarted it without any luck
Googled for this and everything I found says this should work
Any suggestions?

Auguy
Sylvania/Toledo Ohio
 
>Any suggestions?

yes ... but you probably won't like them.

>everything I found says this should work

Except, as you have found it doesn't work for VS2022; VS2022 is a bit buggy when it comes to the GUI setting the startup object. My workaround is to open the solution in VS2019 instead, set the startup object to Sub Main there, then switch back to 2022. From that point onwards, Sub Main correctly appears in the Startup Object dropdown (at least, it does for me) and works as expected. Unless you switch back to a form and then restart 2022 - in which case it vanishes again ...

Sadly this remains the case even in the latest release, version 17.5.3
 
Thanks, MS does it again!
I may move back to VS2019.
Having all issues in 2022.
Every time I make a change to a form in the designer I have to save and close it.
If I don't, then some of my user controls are missing and the app won't run.
Even if I make a small change like moving a control.
It doesn't always happen, but most of the time.
Very frustrating.
See my post form Feb this year.


Auguy
Sylvania/Toledo Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top