473,770 Members | 4,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1735
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******** *************** ***********@mic rosoft.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 "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"
<ro*@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" <no****@noreply .orgwrote in message
news:1C******* *************** ************@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
Jun 27 '08 #3

<Ju********@hom e.netwrote in message
news:om******** *************** *********@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"
<ro*@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" <no****@noreply .orgwrote in message
news:1C****** *************** *************@m icrosoft.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.publi c.dotnet.langua ges.vb "Lloyd Sheen" <a@b.cwrote:

>>>"Jeff Ciaccio" <no****@noreply .orgwrote in message
news:1C***** *************** **************@ microsoft.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

Jun 27 '08 #5

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

Similar topics

17
3839
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 you, SK
6
2312
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 in several forms and reports. Is this an easy process and how would I do this. I know how to read the data and place them in the variables but I can't figure out how to automate this at startup.
2
2891
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 option by code at next database launch to not display the hidden objects. Would it be possible to do this setting by some auto executed (VBA) code at database launch? Best regards Niels
13
3347
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 (app.exe) is deployed on the Client's PC. The only way I know - is to place a shortcut on the desktop and associate a "ShortCut Key" to it by right-clicking on the shorcut on the desktop. Now - how do I, do that during installation using Windows...
6
5216
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? Thanks, Ron
5
1885
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 program). I can get the program to start using System.Diagnostics.Process.Start(@"C:\Program Files\Trillian\trillian.exe");
8
1988
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. I previously did this with a sleep at the first row of the source code, but this makes the process visible in the task manager's processes tab during the sleep (before the "real application" is actually running), and I dont want that.
6
3448
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 startup paths are different for each user. However, the shortcuts for these apps are created in the same Start directory for each user. Is it possible to launch app2 from app1 by calling the shortcut of app2 (or vice versa)? How to do this? Or, how...
0
1481
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 the computer. I have two other user accounts on the same computer and they work fine and launch on startup. Any ideas why this is happening? This occured after I installed and ran PC Tools Spyware Doctor but I can't see any reference to it in...
0
9602
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9439
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.