Description
Anyone finding this page probably already knows that they should only have one Sub Main. The only reason that you would end up with 2 sub Mains is that you wanted to start up your app with a procedure rather than a form-perhaps because you wanted to select which form to start with depending on the command line. This page gives absolutely no info about this at all. at the very least it should say, "You may not use a 'Sub Main' in a Windows Forms App." Better yet, it might suggest how to access the My.Myapplication.Main procedure. (I have accessed it before accidentally by changing the name of the startup form improperly. During compile you get the error "
not found." and you will be taken to the hidden My.Myapplication.Main. Double clicking on the 'Sub Main' is declared more than once in '' error listing will not take you there, nor will double clicking on the "Main" item in the solution explorer. As it currently sits, this page relays no useful information.Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 1a3a8372-76a1-02b6-c92e-1534b6984222
- Version Independent ID: 53b5784a-f891-2131-3951-32e05652132d
- Content: 'Sub Main' is declared more than once in '<namespace>': <message> - Visual Basic
- Content Source: docs/visual-basic/misc/bc30738.md
- Product: dotnet-visualbasic
- Technology: vb-diagnostics
- GitHub Login: @KathleenDollard
- Microsoft Alias: kdollard