INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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

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


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!

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

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close