Application.StartupPath Propiedad

Definición

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

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

Valor de propiedad

String

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 de Windows Forms se implementa mediante ClickOnce. ClickOnce aplicaciones se almacenan en una caché de aplicaciones por usuario en el directorio C:\Documents y Configuración\ username. Para obtener más información, vea Obtener acceso a datos locales y remotos en ClickOnce Aplicaciones.

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