Solved

How do I add a startup event to my App ?

Posted on 2008-10-20
3
188 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
Comment Utility
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
Comment Utility
Hi JMO9966...did my comments help you at all?...
0
 

Author Comment

by:JMO9966
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now