Solved

How do I add a startup event to my App ?

Posted on 2008-10-20
3
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

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 86

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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
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 …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

623 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