PDA

Click to See Complete Forum and Search --> : Data Control Confusion


dchapin
Jul 26th, 1999, 02:47 AM
I am just learning Visual Basic and learning on VB 5.0. I am currently trying to create an address book, contact database. All is going well including creation of new .mdb file "address book", I want the user to be able to create a new book whenever they like. Anyway, this all seems to be working fine. THE PROBLEM, I want the application to open remembering the last used address book. I have spent 100.00 on vb programming books and hours on the internet trying to figure this one out. Please Help...
I know this project is REALLY overdone but I figured it would be a simple enough project to create to learn vb. Any reply's would be appreciated. THANKS

mcleran
Jul 26th, 1999, 05:34 PM
In the Form_Unload event you could persist the last used database file name in the registry. Then, in the Form_Load event, your app could check that value and open the database.

Use the VB function SaveSetting to save the last db file used. Use the GetSetting function to retrieve it on Form_Load.

preeti
Jul 26th, 1999, 05:35 PM
Hi,

You could use GetSetting(appname, section, key[, default]) and SaveSetting appname, section, key, setting functions.

The SaveSetting saves a value in the Windows registry for the application and GetSetting retrieves this setting.

Ex:

SaveSetting app.exename, "DataBase", "LastUsed", "nameofdatabase"

dbname = GetSetting(app.exename, "Database", "LastUsed")

HTH,

Preeti

------------------