Solved

How do I add a startup event to my App ?

Posted on 2008-10-20
3
193 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

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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 …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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