Application.StartupPath Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene il percorso del file eseguibile che ha avviato l'applicazione, senza includere il nome eseguibile.
public:
static property System::String ^ StartupPath { System::String ^ get(); };
public static string StartupPath { get; }
static member StartupPath : string
Public Shared ReadOnly Property StartupPath As String
Valore della proprietà
Percorso del file eseguibile che ha avviato l'applicazione.
Questo percorso sarà diverso a seconda che l'applicazione Windows Forms venga distribuita usando ClickOnce. Le applicazioni ClickOnce vengono archiviate in una cache delle applicazioni per utente nella directory C:\Documents and Settings\username . Per altre informazioni, vedere Accesso ai dati locali e remoti nelle applicazioni ClickOnce.
Esempio
L'esempio di codice seguente ottiene questa proprietà e ne visualizza il valore in una casella di testo. L'esempio richiede che textBox1 sia stato inserito in un modulo.
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