Keeping application alive starting from Sub Main()

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

    Keeping application alive starting from Sub Main()

    Hi,
    i'm moving my first steps in vb.NET world and i'm getting
    first troubles..

    in vb6 i can start an application from Sub Main() and load
    for example a form using 'set' and 'show' command. The
    output for the user will be the form and the program will
    still run.

    In vb .NET, if i made it in the same way, will be no
    output for the user because the program terminate when the
    execution reach the End Sub statement of the Sub Main().

    I think this happens because the form is declared in
    Module. There's a way to do so?

    Can anyone help me?
    Thanks in advance
  • One Handed Man \( OHM#\)

    #2
    Re: Keeping application alive starting from Sub Main()

    Hi,
    You could create a blank project and put a Sub Main() in it, this
    would be the default startpoint. However, it is unlikely you would want to
    do it this way really, you should try and think VB.NET rather than the old
    way. For example, create a windows forms application in VB>NET and you will
    find that your primary form ( Form1 ) is the startup class. when you run it
    the form will appear.

    regards - OHM



    "Vell" <anonymous@disc ussions.microso ft.com> wrote in message
    news:17afc01c41 981$9db92a50$a3 01280a@phx.gbl. ..[color=blue]
    > Hi,
    > i'm moving my first steps in vb.NET world and i'm getting
    > first troubles..
    >
    > in vb6 i can start an application from Sub Main() and load
    > for example a form using 'set' and 'show' command. The
    > output for the user will be the form and the program will
    > still run.
    >
    > In vb .NET, if i made it in the same way, will be no
    > output for the user because the program terminate when the
    > execution reach the End Sub statement of the Sub Main().
    >
    > I think this happens because the form is declared in
    > Module. There's a way to do so?
    >
    > Can anyone help me?
    > Thanks in advance[/color]


    Comment

    • One Handed Man \( OHM#\)

      #3
      Re: Keeping application alive starting from Sub Main()

      Hi,
      You could create a blank project and put a Sub Main() in it, this
      would be the default startpoint. However, it is unlikely you would want to
      do it this way really, you should try and think VB.NET rather than the old
      way. For example, create a windows forms application in VB>NET and you will
      find that your primary form ( Form1 ) is the startup class. when you run it
      the form will appear.

      regards - OHM



      "Vell" <anonymous@disc ussions.microso ft.com> wrote in message
      news:17afc01c41 981$9db92a50$a3 01280a@phx.gbl. ..[color=blue]
      > Hi,
      > i'm moving my first steps in vb.NET world and i'm getting
      > first troubles..
      >
      > in vb6 i can start an application from Sub Main() and load
      > for example a form using 'set' and 'show' command. The
      > output for the user will be the form and the program will
      > still run.
      >
      > In vb .NET, if i made it in the same way, will be no
      > output for the user because the program terminate when the
      > execution reach the End Sub statement of the Sub Main().
      >
      > I think this happens because the form is declared in
      > Module. There's a way to do so?
      >
      > Can anyone help me?
      > Thanks in advance[/color]


      Comment

      • Gary Milton

        #4
        Re: Keeping application alive starting from Sub Main()

        Hi Vell,

        If you are starting a form from Sub Main, you need to run it using
        Application.Run so that a message loop is started and the application
        doesn't terminate until the form is unloaded...

        \\\
        Public Sub Main()
        Application.Run (New MyForm)
        End Sub
        ///

        Hope this helps,
        Gary

        "Vell" <anonymous@disc ussions.microso ft.com> wrote in message
        news:17afc01c41 981$9db92a50$a3 01280a@phx.gbl. ..[color=blue]
        > Hi,
        > i'm moving my first steps in vb.NET world and i'm getting
        > first troubles..
        >
        > in vb6 i can start an application from Sub Main() and load
        > for example a form using 'set' and 'show' command. The
        > output for the user will be the form and the program will
        > still run.
        >
        > In vb .NET, if i made it in the same way, will be no
        > output for the user because the program terminate when the
        > execution reach the End Sub statement of the Sub Main().
        >
        > I think this happens because the form is declared in
        > Module. There's a way to do so?
        >
        > Can anyone help me?
        > Thanks in advance[/color]


        Comment

        • Gary Milton

          #5
          Re: Keeping application alive starting from Sub Main()

          Hi Vell,

          If you are starting a form from Sub Main, you need to run it using
          Application.Run so that a message loop is started and the application
          doesn't terminate until the form is unloaded...

          \\\
          Public Sub Main()
          Application.Run (New MyForm)
          End Sub
          ///

          Hope this helps,
          Gary

          "Vell" <anonymous@disc ussions.microso ft.com> wrote in message
          news:17afc01c41 981$9db92a50$a3 01280a@phx.gbl. ..[color=blue]
          > Hi,
          > i'm moving my first steps in vb.NET world and i'm getting
          > first troubles..
          >
          > in vb6 i can start an application from Sub Main() and load
          > for example a form using 'set' and 'show' command. The
          > output for the user will be the form and the program will
          > still run.
          >
          > In vb .NET, if i made it in the same way, will be no
          > output for the user because the program terminate when the
          > execution reach the End Sub statement of the Sub Main().
          >
          > I think this happens because the form is declared in
          > Module. There's a way to do so?
          >
          > Can anyone help me?
          > Thanks in advance[/color]


          Comment

          • Cor

            #6
            Re: Keeping application alive starting from Sub Main()

            Hi OHM,

            My kind of style, I love you.
            Nice to see those rows with people I did see so much last month

            :-)

            Cor


            Comment

            • Cor

              #7
              Re: Keeping application alive starting from Sub Main()

              Hi OHM,

              My kind of style, I love you.
              Nice to see those rows with people I did see so much last month

              :-)

              Cor


              Comment

              • Guest's Avatar

                #8
                Re: Keeping application alive starting from Sub Main()

                Hi again,

                thank you all...

                Gary your tip works fine...

                bye

                [color=blue]
                >-----Original Message-----
                >Hi Vell,
                >
                >If you are starting a form from Sub Main, you need to run[/color]
                it using[color=blue]
                >Application.Ru n so that a message loop is started and the[/color]
                application[color=blue]
                >doesn't terminate until the form is unloaded...
                >
                >\\\
                >Public Sub Main()
                > Application.Run (New MyForm)
                >End Sub
                >///
                >
                >Hope this helps,
                >Gary
                >
                >"Vell" <anonymous@disc ussions.microso ft.com> wrote in[/color]
                message[color=blue]
                >news:17afc01c4 1981$9db92a50$a 301280a@phx.gbl ...[color=green]
                >> Hi,
                >> i'm moving my first steps in vb.NET world and i'm[/color][/color]
                getting[color=blue][color=green]
                >> first troubles..
                >>
                >> in vb6 i can start an application from Sub Main() and[/color][/color]
                load[color=blue][color=green]
                >> for example a form using 'set' and 'show' command. The
                >> output for the user will be the form and the program[/color][/color]
                will[color=blue][color=green]
                >> still run.
                >>
                >> In vb .NET, if i made it in the same way, will be no
                >> output for the user because the program terminate when[/color][/color]
                the[color=blue][color=green]
                >> execution reach the End Sub statement of the Sub Main().
                >>
                >> I think this happens because the form is declared in
                >> Module. There's a way to do so?
                >>
                >> Can anyone help me?
                >> Thanks in advance[/color]
                >
                >
                >.
                >[/color]

                Comment

                • Guest's Avatar

                  #9
                  Re: Keeping application alive starting from Sub Main()

                  Hi again,

                  thank you all...

                  Gary your tip works fine...

                  bye

                  [color=blue]
                  >-----Original Message-----
                  >Hi Vell,
                  >
                  >If you are starting a form from Sub Main, you need to run[/color]
                  it using[color=blue]
                  >Application.Ru n so that a message loop is started and the[/color]
                  application[color=blue]
                  >doesn't terminate until the form is unloaded...
                  >
                  >\\\
                  >Public Sub Main()
                  > Application.Run (New MyForm)
                  >End Sub
                  >///
                  >
                  >Hope this helps,
                  >Gary
                  >
                  >"Vell" <anonymous@disc ussions.microso ft.com> wrote in[/color]
                  message[color=blue]
                  >news:17afc01c4 1981$9db92a50$a 301280a@phx.gbl ...[color=green]
                  >> Hi,
                  >> i'm moving my first steps in vb.NET world and i'm[/color][/color]
                  getting[color=blue][color=green]
                  >> first troubles..
                  >>
                  >> in vb6 i can start an application from Sub Main() and[/color][/color]
                  load[color=blue][color=green]
                  >> for example a form using 'set' and 'show' command. The
                  >> output for the user will be the form and the program[/color][/color]
                  will[color=blue][color=green]
                  >> still run.
                  >>
                  >> In vb .NET, if i made it in the same way, will be no
                  >> output for the user because the program terminate when[/color][/color]
                  the[color=blue][color=green]
                  >> execution reach the End Sub statement of the Sub Main().
                  >>
                  >> I think this happens because the form is declared in
                  >> Module. There's a way to do so?
                  >>
                  >> Can anyone help me?
                  >> Thanks in advance[/color]
                  >
                  >
                  >.
                  >[/color]

                  Comment

                  • One Handed Man \( OHM#\)

                    #10
                    Re: Keeping application alive starting from Sub Main()

                    Well Cor, I really dont think saying "I Love you" was what you really meant,
                    at least I hope not. ! and that we are dealing with a language issue here !

                    I think what you meant to say was 'you like the way I answered the
                    question'.

                    Regards - OHM



                    "Cor" <non@non.com> wrote in message
                    news:eI8LHiYGEH A.3288@TK2MSFTN GP12.phx.gbl...[color=blue]
                    > Hi OHM,
                    >
                    > My kind of style, I love you.
                    > Nice to see those rows with people I did see so much last month
                    >
                    > :-)
                    >
                    > Cor
                    >
                    >[/color]


                    Comment

                    • One Handed Man \( OHM#\)

                      #11
                      Re: Keeping application alive starting from Sub Main()

                      Well Cor, I really dont think saying "I Love you" was what you really meant,
                      at least I hope not. ! and that we are dealing with a language issue here !

                      I think what you meant to say was 'you like the way I answered the
                      question'.

                      Regards - OHM



                      "Cor" <non@non.com> wrote in message
                      news:eI8LHiYGEH A.3288@TK2MSFTN GP12.phx.gbl...[color=blue]
                      > Hi OHM,
                      >
                      > My kind of style, I love you.
                      > Nice to see those rows with people I did see so much last month
                      >
                      > :-)
                      >
                      > Cor
                      >
                      >[/color]


                      Comment

                      • Cor

                        #12
                        Re: Keeping application alive starting from Sub Main()

                        OHM,

                        No not real the language question, was just for fun to overdo it.

                        :-))

                        Cor


                        Comment

                        • Cor

                          #13
                          Re: Keeping application alive starting from Sub Main()

                          OHM,

                          No not real the language question, was just for fun to overdo it.

                          :-))

                          Cor


                          Comment

                          • One Handed Man \( OHM#\)

                            #14
                            Re: Keeping application alive starting from Sub Main()

                            Thank God For That !



                            "Cor" <non@non.com> wrote in message
                            news:ulzOLKaGEH A.628@TK2MSFTNG P10.phx.gbl...[color=blue]
                            > OHM,
                            >
                            > No not real the language question, was just for fun to overdo it.
                            >
                            > :-))
                            >
                            > Cor
                            >
                            >[/color]


                            Comment

                            • One Handed Man \( OHM#\)

                              #15
                              Re: Keeping application alive starting from Sub Main()

                              Thank God For That !



                              "Cor" <non@non.com> wrote in message
                              news:ulzOLKaGEH A.628@TK2MSFTNG P10.phx.gbl...[color=blue]
                              > OHM,
                              >
                              > No not real the language question, was just for fun to overdo it.
                              >
                              > :-))
                              >
                              > Cor
                              >
                              >[/color]


                              Comment

                              Working...