[02/03] Storing App Location
I created an mdi application that manages it's own Access database. I noticed that I couldn't use Environment.CurrentDirectory to locate the database at runtime because the use of SaveFileDialogBoxes changes the current directory. I got around this by using a ReadOnly constant in the parent form and then referenced from the child forms. Like this:
Parent
Code:
Public ReadOnly mdbLocation As String = Environment.CurrentDirectory & "\am090506.mdb;"
Child
Code:
Dim parForm As New uiMainForm
Dim appLoc As String = parForm.mdbLocation
...Which later uses like this:
Code:
Dim bomConString As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data " & _
"Source=" & appLoc & _
"Jet OLEDB:Database Password=*****;"
The problem I immediately see from doing it this way is the memory usage because I will have two instances of the parent form open all the time (Every child form uses the database). Is there a better way of doing this?
Re: [02/03] Storing App Location
Gets the path for the executable file that started the application, not including the exicutable name.