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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to find paths for .exe and an Access db for use on install 1

Status
Not open for further replies.

faxpay

Programmer
Nov 30, 2004
119
0
0
US
Hello All,

I am in VS 2013 Express writing in Visual Basic. I am trying to write to allow for Installation by the user of my project package to any directory they so choose.

I am a novice programmer. When the project is opened by the user it needs to find the .exe file absolute path to start the project.
How do I get that path and then where do I use it? Do I create a short cut in the install package? Or will Windows provide a start in the listed programs? Or both?

I have used:
Path.GetFullPath(MyFilename)
and
Dim MyFilename As String = "Access_testSQL.exe"
Dim getInfo As System.IO.FileInfo
Dim MyPath As System.IO.Path
getInfo = My.Computer.FileSystem.GetFileInfo("Access_testSQL.exe")

They both retutn a path but the wrong one. Is it because I am in VS testing? How do I test this?

I also need to find the path for an access db in the package but I am having the same trouble.

Thank You in Advance,
Tom
tnfaxpay

 

Place the DB in the same directory as the EXE, or in a directory under the EXE's directory, then use Application.StartupPath(). If the DB is in the same directory as the EXE, just use Application.StartupPath() for both. If the DB is in a sub-directory under the EXE's directory, use Application.StartupPath() and append the sub-directory (for example, Application.StartupPath() & "\Resource\DB\Database1.accdb").


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Hi jebenson,

Where do I use or put Application.StartupPath() & "My.exe"?

I can see that I use Application.StartupPath() & "\AppData\Database1.accdb" when I want to point to the db, such as:

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Application.StartupPath() & "\AppData\Database1.accdb"

But I do not get where I insert that direction to the .exe

I guess when I compile the .exe that direction to the .exe is included but I don't know where it goes in my project.

Thank You,
Tom
tnfaxpay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top