launch on startup

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

    launch on startup

    I'm new to vb.net and was wondering what the syntax is for application
    events such as starting up or shutting down. For example, if you would just
    like to get a user's name with an input box when they open the app or a
    form.

    Thanks

    --
    Jeff Ciaccio
    Physics and AP Physics Teacher
    Sprayberry High School; Marietta, GA
    Blog: http://sprayberry.typepad.com/ciaccio

  • Rob Blackmore

    #2
    Re: launch on startup

    It depends on what you want the application to do and what type of
    application you are creating (Windows Forms, WPF, Web, etc) - not much help
    I know.

    Can you give us an idea of the scope of your application and we can offer
    more help either on the newsgroup or by emailing me directly.

    It is also worth picking up a VB.Net book or two to help you get started.

    Kind regards

    Rob


    "Jeff Ciaccio" <noname@noreply .orgwrote in message
    news:1C791039-FFB3-406D-8FA4-E5082026914A@mi crosoft.com...
    I'm new to vb.net and was wondering what the syntax is for application
    events such as starting up or shutting down. For example, if you would
    just like to get a user's name with an input box when they open the app or
    a form.
    >
    Thanks
    >
    --
    Jeff Ciaccio
    Physics and AP Physics Teacher
    Sprayberry High School; Marietta, GA
    Blog: http://sprayberry.typepad.com/ciaccio

    Comment

    • Just_a_fan@home.net

      #3
      Re: Re: launch on startup

      I just found "ApplicationEve nts.vb" which is hidden by default. I
      forget how to show it but it is probably easy to find -- I found it so
      how hard could it be!

      It has several events but no prototypes. That seems a tremendous
      oversight!

      I am using the one for StartupNextInst ance to notify the user that the
      program was started twice. The application takes care of exiting (if
      you set the single instance check in My Project>Applica tion) but not
      notifying the user. If the application is hidden in some way and the
      user clicks on the icon/shortcut once again, then just quitting is not
      helpful to the user. They will probably click it a few more times and
      then logoff or reboot thinking something is drastically wrong. So a
      message seems appropriate.

      It took a little time to get it right since there are no prototypes.

      Here are the events that this namespace handles:
      ------------------------------------------------
      ' The following events are available for MyApplication:
      '
      ' Startup: Raised when the application starts, before the startup form
      is created.

      ' Shutdown: Raised after all application forms are closed. This event
      is not raised if the application terminates abnormally.

      ' UnhandledExcept ion: Raised if the application encounters an
      unhandled exception.

      ' StartupNextInst ance: Raised when launching a single-instance
      application and the application is already active.

      ' NetworkAvailabi lityChanged: Raised when the network connection is
      connected or disconnected.
      ------------------------------------------------
      That might be too early for you if you want to get input from a text
      box, though. That's code after you are running, not during startup.

      Here is the code for notifying the user of a multiple invocation:

      Private Sub NotAgain(ByVal sender As Object, ByVal e As
      Microsoft.Visua lBasic.Applicat ionServices.Sta rtupNextInstanc eEventArgs)
      Handles Me.StartupNextI nstance
      MsgBox("Only one copy of PVM1010 Companion can run on a computer.
      Second invocation is exiting.")
      End Sub

      (note the lines are wrapped due to Usenet length restrictions, not VB
      line continuation)

      To make this work for startup, remove the characters "NextInstan ce"
      everywhere it appears. I don't know the prototypes for the other calls.
      Good luck on that. Intellisense might help you with it but you have to
      type it all manually as far as I can tell.

      Mike



      On Tue, 24 Jun 2008 20:15:15 +0100, in
      microsoft.publi c.dotnet.langua ges.vb "Rob Blackmore"
      <rob@robblackmo re.comwrote:
      >It depends on what you want the application to do and what type of
      >application you are creating (Windows Forms, WPF, Web, etc) - not much help
      >I know.
      >
      >Can you give us an idea of the scope of your application and we can offer
      >more help either on the newsgroup or by emailing me directly.
      >
      >It is also worth picking up a VB.Net book or two to help you get started.
      >
      >Kind regards
      >
      >Rob
      >
      >
      >"Jeff Ciaccio" <noname@noreply .orgwrote in message
      >news:1C79103 9-FFB3-406D-8FA4-E5082026914A@mi crosoft.com...
      >I'm new to vb.net and was wondering what the syntax is for application
      >events such as starting up or shutting down. For example, if you would
      >just like to get a user's name with an input box when they open the app or
      >a form.
      >>
      >Thanks
      >>
      >--
      >Jeff Ciaccio
      >Physics and AP Physics Teacher
      >Sprayberry High School; Marietta, GA
      >Blog: http://sprayberry.typepad.com/ciaccio

      Comment

      • Lloyd Sheen

        #4
        Re: Re: launch on startup


        <Just_a_fan@hom e.netwrote in message
        news:omv764pnbf pbstc4j8kbp7274 jtk6t9v0g@4ax.c om...
        >I just found "ApplicationEve nts.vb" which is hidden by default. I
        forget how to show it but it is probably easy to find -- I found it so
        how hard could it be!
        >
        It has several events but no prototypes. That seems a tremendous
        oversight!
        >
        I am using the one for StartupNextInst ance to notify the user that the
        program was started twice. The application takes care of exiting (if
        you set the single instance check in My Project>Applica tion) but not
        notifying the user. If the application is hidden in some way and the
        user clicks on the icon/shortcut once again, then just quitting is not
        helpful to the user. They will probably click it a few more times and
        then logoff or reboot thinking something is drastically wrong. So a
        message seems appropriate.
        >
        It took a little time to get it right since there are no prototypes.
        >
        Here are the events that this namespace handles:
        ------------------------------------------------
        ' The following events are available for MyApplication:
        '
        ' Startup: Raised when the application starts, before the startup form
        is created.
        >
        ' Shutdown: Raised after all application forms are closed. This event
        is not raised if the application terminates abnormally.
        >
        ' UnhandledExcept ion: Raised if the application encounters an
        unhandled exception.
        >
        ' StartupNextInst ance: Raised when launching a single-instance
        application and the application is already active.
        >
        ' NetworkAvailabi lityChanged: Raised when the network connection is
        connected or disconnected.
        ------------------------------------------------
        That might be too early for you if you want to get input from a text
        box, though. That's code after you are running, not during startup.
        >
        Here is the code for notifying the user of a multiple invocation:
        >
        Private Sub NotAgain(ByVal sender As Object, ByVal e As
        Microsoft.Visua lBasic.Applicat ionServices.Sta rtupNextInstanc eEventArgs)
        Handles Me.StartupNextI nstance
        MsgBox("Only one copy of PVM1010 Companion can run on a computer.
        Second invocation is exiting.")
        End Sub
        >
        (note the lines are wrapped due to Usenet length restrictions, not VB
        line continuation)
        >
        To make this work for startup, remove the characters "NextInstan ce"
        everywhere it appears. I don't know the prototypes for the other calls.
        Good luck on that. Intellisense might help you with it but you have to
        type it all manually as far as I can tell.
        >
        Mike
        >
        >
        >
        On Tue, 24 Jun 2008 20:15:15 +0100, in
        microsoft.publi c.dotnet.langua ges.vb "Rob Blackmore"
        <rob@robblackmo re.comwrote:
        >
        >>It depends on what you want the application to do and what type of
        >>application you are creating (Windows Forms, WPF, Web, etc) - not much
        >>help
        >>I know.
        >>
        >>Can you give us an idea of the scope of your application and we can offer
        >>more help either on the newsgroup or by emailing me directly.
        >>
        >>It is also worth picking up a VB.Net book or two to help you get started.
        >>
        >>Kind regards
        >>
        >>Rob
        >>
        >>
        >>"Jeff Ciaccio" <noname@noreply .orgwrote in message
        >>news:1C7910 39-FFB3-406D-8FA4-E5082026914A@mi crosoft.com...
        >>I'm new to vb.net and was wondering what the syntax is for application
        >>events such as starting up or shutting down. For example, if you would
        >>just like to get a user's name with an input box when they open the app
        >>or
        >>a form.
        >>>
        >>Thanks
        >>>
        >>--
        >>Jeff Ciaccio
        >>Physics and AP Physics Teacher
        >>Sprayberry High School; Marietta, GA
        >>Blog: http://sprayberry.typepad.com/ciaccio
        >
        Which version of VS are you using. Both 2005 and 2008 have access to all
        application events thru the project properties. (not that intuitive but
        ....). Right click on your project , select properties. On the displayed
        dialog select "View Application Events". From the IDE you should be able to
        dropdown the events and get the IDE to generate the stubs.

        On the same dialog is the "Make single instance application" check box.
        This is only available if you have "Enable application framework" checked.

        Hope this helps
        LS

        Comment

        • Just_a_fan@home.net

          #5
          Re: Re: Re: launch on startup

          On Thu, 26 Jun 2008 17:22:08 -0400, in
          microsoft.publi c.dotnet.langua ges.vb "Lloyd Sheen" <a@b.cwrote:

          >>>"Jeff Ciaccio" <noname@noreply .orgwrote in message
          >>>news:1C79103 9-FFB3-406D-8FA4-E5082026914A@mi crosoft.com...
          >>>I'm new to vb.net and was wondering what the syntax is for application
          >>>events such as starting up or shutting down. For example, if you would
          >>>just like to get a user's name with an input box when they open the app
          >>>or
          >>>a form.
          >>>>
          >>>Thanks
          >>>>
          >>>--
          >>>Jeff Ciaccio
          >>>Physics and AP Physics Teacher
          >>>Sprayberry High School; Marietta, GA
          >>>Blog: http://sprayberry.typepad.com/ciaccio
          >>
          >
          >Which version of VS are you using. Both 2005 and 2008 have access to all
          >application events thru the project properties. (not that intuitive but
          >...). Right click on your project , select properties. On the displayed
          >dialog select "View Application Events". From the IDE you should be able to
          >dropdown the events and get the IDE to generate the stubs.
          >
          >On the same dialog is the "Make single instance application" check box.
          >This is only available if you have "Enable application framework" checked.
          >
          >Hope this helps
          >LS
          VS2008/VB9 is my current weapon against paying for all software.

          And speaking of non-intuitive. You have to check something to get
          "Configurat ion" to appear (it does not even show, never mind disabled)
          in Project Properties>Comp ile. I found it after some searching. I had
          seen it before but it went away and finding it was quite a pain since I
          could not see it, I did not know what to search for to get it back.
          Goodness, some of the options are in the strangest places! I don't
          remember what and were you check to get Configuration and Platform to
          appear. It is hidden somewhere. Why the would hide it instead of
          disabling it is another little mystery of life.

          And, yes, dropping down the event name does create the prototype. I had
          never done that. It works!

          Thanks,
          Mike

          Comment

          Working...