Application.StartupPath-Eigenschaft
Ruft den Pfad ohne den Namen der ausführbaren Datei ab, die zum Starten der Anwendung verwendet wurde.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Shared ReadOnly Property StartupPath As String
'Usage
Dim value As String
value = Application.StartupPath
public static string StartupPath { get; }
public:
static property String^ StartupPath {
String^ get ();
}
/** @property */
public static String get_StartupPath ()
public static function get StartupPath () : String
Eigenschaftenwert
Der Pfad für die ausführbare Datei, die die Anwendung gestartet hat.
Beispiel
Im folgenden Codebeispiel wird diese Eigenschaft abgerufen und ihr Wert in einem Textfeld angezeigt. Dafür ist erforderlich, dass textBox1
in einem Formular platziert wurde.
Private Sub PrintStartupPath()
textBox1.Text = "The path for the executable file that " & _
"started the application is: " & _
Application.StartupPath
End Sub
private void PrintStartupPath() {
textBox1.Text = "The path for the executable file that " +
"started the application is: " +
Application.StartupPath;
}
private:
void PrintStartupPath()
{
textBox1->Text = String::Concat( "The path for the executable file",
" that started the application is: ", Application::StartupPath );
}
private void PrintStartupPath()
{
textBox1.set_Text("The path for the executable file that "
+ "started the application is: " + Application.get_StartupPath());
} //PrintStartupPath
.NET Framework-Sicherheit
- FileIOPermission zum Abrufen des Pfads. Zugeordnete Enumeration: FileIOPermissionAccess.PathDiscovery
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
Application-Klasse
Application-Member
System.Windows.Forms-Namespace