The Application class provides static properties and methods for controlling the application. This appendix contains a summary of the Application class’s most useful properties, methods, and events. Chapter 27 has a bit more to say about the Application class and provides some example code.
The following table describes the Application class’s most useful properties.
Property | Purpose |
---|---|
CommonAppDataPath | Returns the path where the program should store application data that is shared by all users. By default, this path has the form base_path\company_name\product_name\product_ version. The base_path is typically C:\Documents and Settings\All Users\Application Data. |
CommonAppDataRegistry | Returns the Registry key where the program should store application data that is shared by all users. By default, this path has the form HKEY_LOCAL_MACHINE\Software\ company_name\product_name\product_version. |
CompanyName | Returns the application’s company name. |
CurrentCulture | Gets or sets the CultureInfo object for this thread. The CultureInfo object specifies information about a specific culture (such as its name, writing system, and calendar, and its formats for dates, times, and numbers). |
CurrentInputLanguage | Gets or sets the InputLanguage for this thread. The InputLanguage object defines the layout of the keyboard for the culture. It determines how the keyboard keys are mapped to the characters in the culture’s language. |
ExecutablePath | Returns the fully qualified path to the file that started the execution, including the file name. |
LocalUserAppDataPath | Returns the path where the program should store data for this local, nonroaming user. By default, this path has the form base_path\ company_name\product_name\product_version. The base_path is typically C:\Documents and Settings\user_name\Local Settings\Application Data. |
MessageLoop | Returns True if the thread has a message loop. If the program begins with a startup form, this loop is created automatically. If it starts with a custom Sub Main, then the loop doesn’t initially exist, and the program must start it by calling Application.Run. |
OpenForms | Returns a collection holding references to all of the application’s open forms. |
ProductName | Returns the application’s product name. |
ProductVersion | Gets the product version associated with this application. |
StartupPath | Returns the fully qualified path to the file that started the execution, including the file name. |
UserAppDataPath | Returns the path where the program should store data for this user. By default, this path has the form base_path\company_name\ product_name\product_version. The base_path is typically C:\Documents and Settings\user_name\Application Data. |
UserAppDataRegistry | Returns the Registry key where the program should store application data for this user. By default, this path has the form HKEY_CURRENT_ USER\Software\company_name\product_name\product_ version. |
UseWaitCursor | Determines whether this thread’s forms display a wait cursor. Set this to True before performing a long operation, and set it to False when the operation is finished. |