|
-
Jun 13th, 1999, 07:40 PM
#2
New Member
you need to modify the setup1 project, and then recompile Setup1.exe - before building you distribution set (cab files etc).
In VB open the setup1 project. open form : 'frmSetup1'. Go to code window.
In the Form_Load event, after 'gstrFontDir' add following code:
'********************************************
'Save information to the Registery
Dim strSrcDrv As String 'Source Drive Letter
Dim strDstDrv As String ' Destination Drive Letter
Dim strDstPth As String ' Destination Path
Dim strDstDrvPth As String
strDstDrv = UCase(Left(gstrDestDir, 1))
strDstPth = UCase(Mid(gstrDestDir, 4))
SaveSetting appname:="MyApp", section:="Drives", Key:="MyDatabase", setting:=strDstDrv & ":\" & strDstPth & "Mydatabase.mdb"
'********************************************
If you include the database in the list of files (package & deployment wiz), the above code will ensure that the registry stores the location of the mdb.
In your program, you will need to use GetSetting, to re-connect data-controls to correct path.
Above does not cater for users moving databases from installation path. So, add a function like:
Private Function FileExists(FileName) As Boolean
'This function designed to Test for exisitience of all databases required
On Error GoTo FileNameErr
FileExists = (Dir(FileName) <> "")
Exit Function
FileNameErr:
MsgBox "The program needs to be reinstalled - it cannot find the database files needed at :' " & FileName & " '. The program will now terminate."
End Function
...where FileName is name of database - retrieved from the registry.
Good Luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|