ApplicationBase Class

 

Provides properties, methods, and events related to the current application.

Namespace:   Microsoft.VisualBasic.ApplicationServices
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

System.Object
  Microsoft.VisualBasic.ApplicationServices.ApplicationBase
    Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase

[HostProtectionAttribute(SecurityAction.LinkDemand, Resources = HostProtectionResource.ExternalProcessMgmt)]
public class ApplicationBase

NameDescription
System_CAPS_pubmethodApplicationBase()

Initializes a new instance of the ApplicationBase class.

NameDescription
System_CAPS_pubpropertyCulture

Gets the culture that the current thread uses for string manipulation and string formatting.

System_CAPS_pubpropertyInfo

Gets an object that provides properties for getting information about the application's assembly, such as the version number, description, and so on.

System_CAPS_pubpropertyLog

Gets an object that provides properties and methods for writing event and exception information to the application's log listeners.

System_CAPS_pubpropertyUICulture

Gets the culture that the current thread uses for retrieving culture-specific resources.

NameDescription
System_CAPS_pubmethodChangeCulture(String)

Changes the culture used by the current thread for string manipulation and for string formatting.

System_CAPS_pubmethodChangeUICulture(String)

Changes the culture that the current thread uses for retrieving culture-specific resources.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetEnvironmentVariable(String)

Returns the value of the specified environment variable.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

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.

The My.Application object consists of the following classes:

  • ApplicationBase provides members that are available in all projects.

  • WindowsFormsApplicationBase provides members that are available in Windows Forms applications.

  • ConsoleApplicationBase provides members that are available in console applications.

This example uses the My.Application.GetEnvironmentVariable method to get and display the value of the PATH environment variable, if this value is available. Otherwise, it displays a message that indicates that the PATH environment variable does not exist.

Private Sub TestGetEnvironmentVariable()
    Try
        MsgBox("PATH = " & My.Application.GetEnvironmentVariable("PATH"))
    Catch ex As System.ArgumentException
        MsgBox("Environment variable 'PATH' does not exist.")
    End Try
End Sub

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: