Application.StartupPath Propriété

Définition

Obtient le chemin du fichier exécutable qui a démarré l’application, sans inclure le nom exécutable.

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

Valeur de propriété

Chemin du fichier exécutable qui a démarré l’application.

Ce chemin d’accès sera différent selon que l’application Windows Forms est déployée à l’aide de ClickOnce. Les applications ClickOnce sont stockées dans un cache d’application par utilisateur dans le répertoire C :\Documents et Settings\username . Pour plus d’informations, consultez Accès aux données locales et distantes dans les applications ClickOnce.

Exemples

L’exemple de code suivant obtient cette propriété et affiche sa valeur dans une zone de texte. L’exemple nécessite qu’il textBox1 ait été placé sur un formulaire.

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

S’applique à