แก้ไข

แชร์ผ่าน


ConsoleApplicationBase Class

Definition

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

public ref class ConsoleApplicationBase : Microsoft::VisualBasic::ApplicationServices::ApplicationBase
public class ConsoleApplicationBase : Microsoft.VisualBasic.ApplicationServices.ApplicationBase
type ConsoleApplicationBase = class
    inherit ApplicationBase
Public Class ConsoleApplicationBase
Inherits ApplicationBase
Inheritance
ConsoleApplicationBase
Derived

Examples

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

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.

The My.Application object consists of the following classes:

Constructors

ConsoleApplicationBase()

Initializes a new instance of the ConsoleApplicationBase class.

Properties

CommandLineArgs

Gets a collection containing the command-line arguments as strings for the current application.

Culture

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

(Inherited from ApplicationBase)
Deployment

Gets the current application's ClickOnce deployment object, which provides support for updating the current deployment programmatically and support for the on-demand download of files.

Info

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

(Inherited from ApplicationBase)
InternalCommandLine

Sets the values to use as the current application's command-line arguments.

IsNetworkDeployed

Gets a Boolean that represents whether the application was deployed from a network using ClickOnce.

Log

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

(Inherited from ApplicationBase)
UICulture

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

(Inherited from ApplicationBase)

Methods

ChangeCulture(String)

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

(Inherited from ApplicationBase)
ChangeUICulture(String)

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

(Inherited from ApplicationBase)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnvironmentVariable(String)

Returns the value of the specified environment variable.

(Inherited from ApplicationBase)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also