Accessing a Running Application in Visual Basic 

This section contains topics that cover how to use the Visual Basic Application model to control the application's run-time behavior, and topics that cover how to get run-time information about the application.

The My.Application object provides properties, methods, and events related to the current application. It allows you to get information about the application, such as the current culture, how the application was deployed, and the environment variables. The Visual Basic Application model exposed by the My.Application object allows an application to run code when the application starts up and shuts down. Similarly, the My.Application.Deployment property provides the current application's ClickOnce deployment object.


To See

Allow your application to handle other events that might be raised while your code runs

My.Application.DoEvents Method

Determine the application's command-line arguments

How to: Access Command-Line Arguments (Visual Basic)

Check if the application started with the string "/batch" as an argument

How to: Enable a Batch Mode for Window Forms Applications

Handle any uncaught exception in your application

My.Application.UnhandledException Event

Use the events provided by the Visual Basic Application model to run code when the application starts or ends

How to: Run Code When the Application Starts or Ends

Check the command-line arguments of subsequent attempts to start a single-instance application

My.Application.StartupNextInstance Event

Download and install the latest version of a ClickOnce application

How to: Download ClickOnce Application Updates

See Also

Community Additions