My.Application Object
Provides properties, methods, and events related to the current application.
Remarks
The properties exposed by the My.Application object return data that is associated only with the current application or DLL. No system-level information can be altered with My.Application.
Some members are available only for Windows Forms or console applications.
Example
This example uses the My.Application.CommandLineArgs property to examine the application's command-line arguments. If an argument is found that starts with /input=, the rest of that argument is displayed.
Private Sub ParseCommandLineArgs()
Dim inputArgument As String = "/input="
Dim inputName As String = ""
For Each s As String In My.Application.CommandLineArgs
If s.ToLower.StartsWith(inputArgument) Then
inputName = s.Remove(0, inputArgument.Length)
End If
Next
If inputName = "" Then
MsgBox("No input name")
Else
MsgBox("Input name: " & inputName)
End If
End Sub
Requirements
Namespace:Microsoft.VisualBasic.ApplicationServices
Class:WindowsFormsApplicationBase (the base class ConsoleApplicationBase provides members available in console applications, and its base class ApplicationBase provides the members that are available in all projects)
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
See Also
Reference
My.Application.ApplicationContext Property
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase