473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

Jun 27 '08 #1
4 1714
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" <no****@noreply.orgwrote in message
news:1C**********************************@microsof t.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
Jun 27 '08 #2
I just found "ApplicationEvents.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 StartupNextInstance 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>Application) 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.

' UnhandledException: Raised if the application encounters an
unhandled exception.

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

' NetworkAvailabilityChanged: 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.VisualBasic.ApplicationServices.StartupN extInstanceEventArgs)
Handles Me.StartupNextInstance
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 "NextInstance"
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.public.dotnet.languages.vb "Rob Blackmore"
<ro*@robblackmore.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" <no****@noreply.orgwrote in message
news:1C**********************************@microso ft.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
Jun 27 '08 #3

<Ju********@home.netwrote in message
news:om********************************@4ax.com...
>I just found "ApplicationEvents.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 StartupNextInstance 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>Application) 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.

' UnhandledException: Raised if the application encounters an
unhandled exception.

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

' NetworkAvailabilityChanged: 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.VisualBasic.ApplicationServices.StartupN extInstanceEventArgs)
Handles Me.StartupNextInstance
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 "NextInstance"
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.public.dotnet.languages.vb "Rob Blackmore"
<ro*@robblackmore.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" <no****@noreply.orgwrote in message
news:1C**********************************@micros oft.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

Jun 27 '08 #4
On Thu, 26 Jun 2008 17:22:08 -0400, in
microsoft.public.dotnet.languages.vb "Lloyd Sheen" <a@b.cwrote:

>>>"Jeff Ciaccio" <no****@noreply.orgwrote in message
news:1C**********************************@micro soft.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
"Configuration" to appear (it does not even show, never mind disabled)
in Project Properties>Compile. 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

Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: SK | last post by:
I am calling an exe thru' href, but when it executes, I get the message if I want to open the file(exe file). Is there any way I can suppress this from appearing and open the program? Thank...
6
by: N. Graves | last post by:
Thanks for taking the time to read my question and hopefully it will be understandable. I have a need to read a record in a table and place the information in public variables that can be used...
2
by: Niels Knabe | last post by:
To simplify the user interface and to protect code I have unchecked the Tools|Options|View|Show Hidden objects. However, if a user selects displaying the hidden objects, I would like to reset this...
13
by: Ole Hanson | last post by:
Hi I am in need of a way to launch my WinForms-app (app.exe) just by pressing a keyboard combination like (Ctrl-Alt-P). This functionality should be present "out of the box" after the app...
6
by: Ronald S. Cook | last post by:
How do I launch, say, Microsoft Word from within a C# Win app? Word should launch exterior to my app, of course. Is it easy to set size and position of where Word window will be placed? ...
5
by: jmsxp | last post by:
Hi all, I am in my infancy with programming, so please forgive stupid questions... I am attempting to write a C# program that will launch Trillian (well, that is just a part of the overall...
8
by: Marcus | last post by:
I have this application I have made that I launch when the user logs into Windows XP. I would like to delay the launch of the application so that it starts 1 minute after the user has logged in. ...
6
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I am deploying vb2005 apps using Click Once deployment. This works fine. The problem is that the user needs to be able to launch a 2nd app from the 1st app, but the application...
0
by: =?Utf-8?B?R2FyeSBNY0M=?= | last post by:
The quick launch tool bar doesn't load on startup in my user account. It works fine by clicking on the Task bar and selecting Quick Launch, but it doesn't seem to save the setting when I shut down...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.