Application.StartupPath Propiedad

Definición

Obtiene la ruta de acceso del archivo ejecutable que inició la aplicación, no incluido el nombre del archivo ejecutable.

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

Valor de propiedad

Ruta de acceso del archivo ejecutable que inició la aplicación.

Esta ruta de acceso será diferente en función de si la aplicación Windows Forms se implementa mediante ClickOnce. Las aplicaciones ClickOnce se almacenan en una caché de aplicaciones por usuario en el directorio C:\Documents and Settings\username . Para obtener más información, consulte Acceso a datos locales y remotos en aplicaciones ClickOnce.

Ejemplos

En el ejemplo de código siguiente se obtiene esta propiedad y se muestra su valor en un cuadro de texto. El ejemplo requiere que textBox1 se haya colocado en un formulario.

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

Se aplica a