Export (0) Print
Expand All

Application.StartupPath Property

Gets the path for the executable file that started the application, not including the executable name.

[Visual Basic]
Public Shared ReadOnly Property StartupPath As String
[C#]
public static string StartupPath {get;}
[C++]
public: __property static String* get_StartupPath();
[JScript]
public static function get StartupPath() : String;

Property Value

The path for the executable file that started the application.

Example

[Visual Basic, C#, C++] The following example gets this property and displays its value in a text box. The example assumes that textBox1 has been placed on a form.

[Visual Basic] 
Private Sub PrintStartupPath()
   textBox1.Text = "The path for the executable file that " & _
      "started the application is: " & _
      Application.StartupPath
End Sub


[C#] 
private void PrintStartupPath() {
    textBox1.Text = "The path for the executable file that " +
       "started the application is: " +
       Application.StartupPath;
 }


[C++] 
private:
   void PrintStartupPath() {
      textBox1->Text = 
         String::Concat(S"The path for the executable file that started the application is: {0}",
            Application::StartupPath);
   }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

Application Class | Application Members | System.Windows.Forms Namespace

Show:
© 2015 Microsoft