Application.StartupPath Propriedade

Definição

Obtém o caminho para o arquivo executável que iniciou o aplicativo, não incluindo o nome do executável.

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 da propriedade

String

O caminho para o arquivo executável que iniciou o aplicativo.

Esse caminho será diferente dependendo se o aplicativo Windows Forms for implantado usando ClickOnce. ClickOnce aplicativos são armazenados em um cache de aplicativo por usuário no diretório C:\Documents e Configurações\ username. Para obter mais informações, confira Acessando dados locais e remotos em aplicativos ClickOnce.

Exemplos

O exemplo de código a seguir obtém essa propriedade e exibe seu valor em uma caixa de texto. O exemplo requer que textBox1 tenha sido colocado em um formulário.

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

Aplica-se a