Application.StartupPath Eigenschaft

Definition

Ruft den Pfad ohne den Namen der ausführbaren Datei ab, die zum Starten der Anwendung verwendet wurde.

public:
 static property System::String ^ StartupPath { System::String ^ get(); };
public static string StartupPath { get; }
member this.StartupPath : string
Public Shared ReadOnly Property StartupPath As String

Eigenschaftswert

String

Der Pfad für die ausführbare Datei, die die Anwendung gestartet hat.

Dieser Pfad unterscheidet sich je nachdem, ob die Windows Forms-Anwendung mithilfe von ClickOnce bereitgestellt wird. ClickOnce Anwendungen werden im Verzeichnis "C:\Documents" und "Einstellungen\ username" in einem Anwendungscache pro Benutzer gespeichert. Weitere Informationen finden Sie unter Zugreifen auf lokale und Remotedaten in ClickOnce Anwendungen.

Beispiele

Im folgenden Codebeispiel wird diese Eigenschaft abgerufen und der Wert in einem Textfeld angezeigt. Das Beispiel erfordert, dass textBox1 es auf einem Formular platziert wurde.

private:
   void PrintStartupPath()
   {
      textBox1->Text = String::Concat( "The path for the executable file",
        " that started the application is: ", Application::StartupPath );
   }
private void PrintStartupPath() {
    textBox1.Text = "The path for the executable file that " +
       "started the application is: " +
       Application.StartupPath;
 }
Private Sub PrintStartupPath()
   textBox1.Text = "The path for the executable file that " & _
      "started the application is: " & _
      Application.StartupPath
End Sub

Gilt für