Sub Main not found error.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Bruneau

    #1

    Sub Main not found error.

    Hi Folks,

    I wonder what I need to do.

    I make a REAL simple design,

    One losuy form that has an allocated 'Name' property - Form1

    I build solution without an issue.

    However, if I change the 'Name' property to say... "Adder" and do the
    same build I will receive an error:

    'Sub Main' not found was not found in 'Adder.Form1'

    I can't find any reference to 'Adder.Form1' nor Sub Main.

    How would I correct the thing, rather than accept "FORM1" as a
    permanent 'Name' property value. Can I not change any of the Form
    names as I choose?

    Thanks -- paul

  • Rick Rothstein

    #2
    Re: Sub Main not found error.

    > I wonder what I need to do.[color=blue]
    >
    > I make a REAL simple design,
    >
    > One losuy form that has an allocated 'Name' property - Form1
    >
    > I build solution without an issue.
    >
    > However, if I change the 'Name' property to say... "Adder" and do the
    > same build I will receive an error:
    >
    > 'Sub Main' not found was not found in 'Adder.Form1'
    >
    > I can't find any reference to 'Adder.Form1' nor Sub Main.
    >
    > How would I correct the thing, rather than accept "FORM1" as a
    > permanent 'Name' property value. Can I not change any of the Form
    > names as I choose?[/color]

    Of course you can rename a Form any time you want. This is only a guess;
    however, it sounds to me like you removed Form1 from the project
    somewhere along the line and then added it back in some time later on
    (renaming it to Adder at that time). If this is correct, then when you
    removed Form1, VB would have automatically made (an assumed to be
    defined) Sub Main as the Startup Object (because it needs something to
    be defined as the Startup Object). When you added Form1 back into the
    project, VB would **not** have reset the Startup Object. I think this
    would produce the error you are seeing.

    Whether my guess above is correct or not, you should be able to
    straighten things out by clicking on Project/Properties in VB's (the
    IDE's) menu and selecting your current form's name in the ComboBox
    labeled StartUp Object (which should now read Sub Main) on the General
    tab.

    Rick - MVP

    Comment

    • J French

      #3
      Re: Sub Main not found error.

      On Mon, 13 Dec 2004 10:34:40 -0500, Paul Bruneau <bruneaup@SPA M
      rogers.com> wrote:
      [color=blue]
      >Hi Folks,
      >
      >I wonder what I need to do.
      >
      > I make a REAL simple design,
      >
      >One losuy form that has an allocated 'Name' property - Form1
      >
      >I build solution without an issue.
      >
      >However, if I change the 'Name' property to say... "Adder" and do the
      >same build I will receive an error:
      >
      >'Sub Main' not found was not found in 'Adder.Form1'[/color]

      I think this might be FRED.NET


      Comment

      • Hal Rosser

        #4
        Re: Sub Main not found error.


        "Paul Bruneau" <bruneaup@SPA M rogers.com> wrote in message
        news:43drr05bjg 51uu5g0qfvh64av 88ob9156u@4ax.c om...[color=blue]
        > Hi Folks,
        >
        > I wonder what I need to do.
        >
        > I make a REAL simple design,
        >
        > One losuy form that has an allocated 'Name' property - Form1
        >
        > I build solution without an issue.
        >
        > However, if I change the 'Name' property to say... "Adder" and do the
        > same build I will receive an error:
        >
        > 'Sub Main' not found was not found in 'Adder.Form1'
        >
        > I can't find any reference to 'Adder.Form1' nor Sub Main.
        >
        > How would I correct the thing, rather than accept "FORM1" as a
        > permanent 'Name' property value. Can I not change any of the Form
        > names as I choose?
        >
        > Thanks -- paul
        >[/color]

        When you first create a project, VB thinks Form1 is the startup object
        when you change the name of Form1, you need to right-click the project in
        the solution explorer, click 'properties' and set the startup object to the
        new name of your form



        ---
        Outgoing mail is certified Virus Free.
        Checked by AVG anti-virus system (http://www.grisoft.com).
        Version: 6.0.807 / Virus Database: 549 - Release Date: 12/8/2004


        Comment

        Working...