Skip to content

'Sub Main' is declared more than once in '<namespace>': <message> #35216

Open
@PeterRoscoe

Description

@PeterRoscoe

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions