Application.StartupPath プロパティ

定義

アプリケーションを開始した実行可能ファイルの、ファイル名を含まないパスを取得します。

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

プロパティ値

String

アプリケーションを開始した実行可能ファイルのパス。

このパスは、ClickOnceを使用してWindows フォーム アプリケーションをデプロイするかどうかによって異なります。 ClickOnceアプリケーションは、C:\Documents および 設定 username ディレクトリのユーザーごとのアプリケーション キャッシュに\格納されます。 詳細については、ローカルへのアクセスとリモート データには、ClickOnce アプリケーション を参照してください。

次のコード例では、このプロパティを取得し、その値をテキスト ボックスに表示します。 この例では、 textBox1 フォームに配置されている必要があります。

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

適用対象