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
ChildCode:Public ReadOnly mdbLocation As String = Environment.CurrentDirectory & "\am090506.mdb;"
...Which later uses like this:Code:Dim parForm As New uiMainForm Dim appLoc As String = parForm.mdbLocation
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?




Reply With Quote