Application.StartupPath Propriedade

Definição

Obtém o caminho do ficheiro executável que iniciou a aplicação, sem incluir o nome do executável.

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 Propriedade

O caminho para o ficheiro executável que iniciou a aplicação.

Este caminho será diferente dependendo de a aplicação Windows Forms ser implementada usando o ClickOnce. As aplicações ClickOnce são armazenadas numa cache de aplicação por utilizador nos diretórios C:\Documents e Settings\username . Para mais informações, consulte Acesso a Dados Locais e Remotos em Aplicações ClickOnce.

Exemplos

O seguinte exemplo de código obtém esta propriedade e apresenta o seu valor numa caixa de texto. O exemplo exige que tenha textBox1 sido colocado num 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