Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining the driectory exe was installed to 2

Status
Not open for further replies.

sicohne

Technical User
Jun 30, 2003
51
GB
My program needs to read a text file from the directory which the program is installed to. Since the user can choose there own installation path, the location of the text file is variable. Is there a way of saving the path chosen (to the registry or some other suggestion)?
 
You might be able to use Environment.CurrentDirectory.

-Kris
 
I use the same method as Kris:

path = System.Environment.CurrentDirectory
Dim inifilename as string = "yourfile.txt"

If Not File.Exists(path & "\" & inifilename) Then
MsgBox("The required file (" & inifilename & ") is missing from path" & vbCrLf & path, MsgBoxStyle.Critical, "Missing file")
Exit Sub
End If
 
Thanks, that seems to work (have only testing it with Debug and not by installing it yet, but don't see why it shouldn't work)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top