How to get a path for .exe file and write this path in one textbox. .exe file is compiled in Visual Studio 2005.
Thanks.
Printable View
How to get a path for .exe file and write this path in one textbox. .exe file is compiled in Visual Studio 2005.
Thanks.
My.Application.Info.DirectoryPath
The code below shows how to get this information
So if the path/file name was TextBox1.Text = IO.Path.GetDirectoryName("C:\Data\kevin.txt")Code:Console.Write(Application.ExecutablePath)
Console.WriteLine(IO.Path.GetDirectoryName(Application.ExecutablePath))
Console.WriteLine(IO.Path.GetFileName(Application.ExecutablePath))
ReturnsCode:TextBox1.Text = IO.Path.GetDirectoryName("C:\Data\kevin.txt")
Even if the file does not exist you still get the path.Code:C:\Data
Yes, that's it. Thanks.