theartha
asked on
Directory Path
Hi There,
I created a Standalone app which goes on a cd along with other files in VB.net.
My question is: As the app reads the files on the cd, how can I get the file path?
Currently I am hardcoding as "C:\", but when it goes on CD hardcoded value may not be valid.
Dim directoryInfo As New IO.DirectoryInfo("C:\")
Dim fileInfo As FileInfo() = directoryInfo.GetFiles()
Dim files As FileInfo
.
.
.
.
.
.
Any advice?
Thanks.
I created a Standalone app which goes on a cd along with other files in VB.net.
My question is: As the app reads the files on the cd, how can I get the file path?
Currently I am hardcoding as "C:\", but when it goes on CD hardcoded value may not be valid.
Dim directoryInfo As New IO.DirectoryInfo("C:\")
Dim fileInfo As FileInfo() = directoryInfo.GetFiles()
Dim files As FileInfo
.
.
.
.
.
.
Any advice?
Thanks.
FileInfo has the DirectoryName and FullName properties, which will give the full name of the file's directory and the full path (including filename) of the file, respectively.
I'm not sure, but I think what you want is the current executable's directory: http://msdn.microsoft.com/en-us/library/aa457089.aspx
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
this will give you the full path of your exe locationONLY if you haven't changed your application's current working directory during the course of execution ; )