Another VB Hidden Feature?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CJ Taylor

    Another VB Hidden Feature?

    Whats up everyone,

    I was playing around with some C# last night and noticed something
    interesting. I built two programs, one VB and one C#. Each had 1 form with
    nothing on it.

    However, the C# form has this

    void sub main() {
    Application.Run (Form1)
    }

    So does VB.NET automatically add this in at compile time, kinda like the
    default constructor thing?

    -CJ


  • Jay B. Harlow [MVP - Outlook]

    #2
    Re: Another VB Hidden Feature?

    CJ,
    Yes this is added, however I would not liken it to the default constructor
    thing per se.

    You can use ILDASM.EXE to see what (IL) code is generated by VB.NET when
    compiles your program.

    Hope this helps
    Jay

    "CJ Taylor" <nospam@blowgoa ts.com> wrote in message
    news:10278k58q3 4cq60@corp.supe rnews.com...[color=blue]
    > Whats up everyone,
    >
    > I was playing around with some C# last night and noticed something
    > interesting. I built two programs, one VB and one C#. Each had 1 form[/color]
    with[color=blue]
    > nothing on it.
    >
    > However, the C# form has this
    >
    > void sub main() {
    > Application.Run (Form1)
    > }
    >
    > So does VB.NET automatically add this in at compile time, kinda like the
    > default constructor thing?
    >
    > -CJ
    >
    >[/color]


    Comment

    • Cor

      #3
      Re: Another VB Hidden Feature?

      Hi CJ,

      Are you never looking what Armin is saying, he told this hundred times in
      this newsgroup.
      He uses the words behind the scene.

      :-)

      Cor
      [color=blue]
      > However, the C# form has this
      >
      > void sub main() {
      > Application.Run (Form1)
      > }
      >
      > So does VB.NET automatically add this in at compile time, kinda like the
      > default constructor thing?
      >[/color]


      Comment

      • CJ Taylor

        #4
        Re: Another VB Hidden Feature?


        "Cor" <non@non.com> wrote in message
        news:%23sgWE4L7 DHA.1816@TK2MSF TNGP12.phx.gbl. ..[color=blue]
        > Hi CJ,
        >
        > Are you never looking what Armin is saying, he told this hundred times in
        > this newsgroup.[/color]

        It's part of a conspiracy agaisnt Armin... =)

        My apologies, must have missed it or selectivly read it until I actually saw
        it. =) Sorry armin.

        -CJ
        [color=blue]
        > He uses the words behind the scene.
        >
        > :-)
        >
        > Cor
        >[color=green]
        > > However, the C# form has this
        > >
        > > void sub main() {
        > > Application.Run (Form1)
        > > }
        > >
        > > So does VB.NET automatically add this in at compile time, kinda like the
        > > default constructor thing?
        > >[/color]
        >
        >[/color]


        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: Another VB Hidden Feature?

          * "CJ Taylor" <nospam@blowgoa ts.com> scripsit:[color=blue]
          > I was playing around with some C# last night and noticed something
          > interesting. I built two programs, one VB and one C#. Each had 1 form with
          > nothing on it.
          >
          > However, the C# form has this
          >
          > void sub main() {
          > Application.Run (Form1)
          > }
          >
          > So does VB.NET automatically add this in at compile time, kinda like the
          > default constructor thing?[/color]

          Yes, something similar (you can have a look at it using "ILDASM.EXE ").
          Nevertheless, you can define the 'Main' method yourself (in a module or
          as a shared method in a class) and select 'Sub Main' as startup object
          in the project's properties dialog.

          --
          Herfried K. Wagner [MVP]
          <http://www.mvps.org/dotnet>

          Comment

          Working...