Solved

How do I add a startup event to my App ?

Posted on 2008-10-20
3
192 Views
Last Modified: 2012-06-21
I typically do my automated programs by running Subroutines from the Form load and then just make the form hiddent and do application.exit after subs have run.

Is a startup event a better way to do this?  If so, how do I creat this event in my main class?

thanks,
JMO9966
0
Comment
Question by:JMO9966
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 250 total points
ID: 22763185
Click on Project --> Properties.
Make sure the "Enable Application Framework" CheckBox is CHECKED.
In the Application Tab, Click on the "View Application Events" Button in the BOTTOM RIGHT.
Across the top of the IDE, change the two dropdowns:
    Left DropDown: "MyApplication" --> "(MyApplication Events)"
    Right DropDown: "(Declarations)" --> "Startup"

You should have this now:

Namespace My
 
    ' The following events are availble 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.
    Partial Friend Class MyApplication
 
        Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
 
            ' ...do your code in here...
 
 
            e.Cancel = True ' make the application close WITHOUT showing any Forms...
 
        End Sub
    End Class
 
End Namespace

Open in new window

0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 22791159
Hi JMO9966...did my comments help you at all?...
0
 

Author Comment

by:JMO9966
ID: 22927449
Thanks Idle,

I ended up taking a different approach, but I will look at what you offer next time I run into this situation.

JMO9966
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question