Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

ApplicationBase Class

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

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

Namespace:  Microsoft.VisualBasic.ApplicationServices
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
[HostProtectionAttribute(SecurityAction.LinkDemand, Resources = HostProtectionResource.ExternalProcessMgmt)]
public class ApplicationBase

The ApplicationBase type exposes the following members.

  NameDescription
Public methodApplicationBaseInitializes a new instance of the ApplicationBase class.
Top
  NameDescription
Public propertyCultureGets the culture that the current thread uses for string manipulation and string formatting.
Public propertyInfoGets an object that provides properties for getting information about the application's assembly, such as the version number, description, and so on.
Public propertyLogGets an object that provides properties and methods for writing event and exception information to the application's log listeners.
Public propertyUICultureGets the culture that the current thread uses for retrieving culture-specific resources.
Top
  NameDescription
Public methodChangeCultureChanges the culture used by the current thread for string manipulation and for string formatting.
Public methodChangeUICultureChanges the culture that the current thread uses for retrieving culture-specific resources.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetEnvironmentVariableReturns the value of the specified environment variable.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

NoteNote

The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: Resources. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

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

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.