How do I refer to the Application folder in VB code?
Posted on 2004-04-18
This is my first vb.net app, using Visual Studio .Net 2003. My app uses an Access database. It installs and runs fine, provided the end-user doesn't change the default install path.
The installation package puts a copy of the .mdb file in the Application Folder. To open this database, I use the following connection string in my code:
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"Data source=C:\Program Files\CompanyName\Appname\Access.mdb"
If the user chooses any other install path, the Access database is placed there, and the application cannot find it.
How do I change that connection string to refer generically to "Application Folder" so it will find the database no matter what install path the user picks?