Application.StartupPath Propriété

Définition

Obtient le chemin d’accès au fichier exécutable ayant démarré l’application, sans le nom de l’exécutable.

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

Valeur de propriété

String

Chemin d’accès au fichier exécutable ayant 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. ClickOnce applications sont stockées dans un cache d’application par utilisateur dans le répertoire C:\Documents et Paramètres\ utilisateur. Pour plus d’informations, consultez Accès aux données locales et distantes dans ClickOnce Applications.

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 à