Solved

How to reloan the setting from last time??

Posted on 2002-06-28
2
161 Views
Last Modified: 2010-05-02
hi, i have a question here. i am doing a project with working few forms and database together. My project requests to reload the program when launch next time that had been up to  so how can i remember the data, the page used last time. i might not explained clearly, just give an example:
just like you are playing the games such as AOE, if you save the game, next time when you load the save, you should get back such like what were those people doing, where was working in the map, what level are you in etc. is it request using savesetting & getsetting?? or something else and can provides any example thinks
0
Comment
Question by:kalok444
2 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 7116429
SaveSetting and GetSetting are probably your best options, these allow you to store the information in the registry and retrieve it. The keys used by these functions in the registry are not exceptionally configurable but are more than adequate for most cases. If not then there are registry functions available that allow even more control and flexibility but you probably don't need this yet.
0
 
LVL 4

Accepted Solution

by:
kpkp earned 20 total points
ID: 7116499
if you're after an example, I've used SaveSetting and GetSetting to do something similar:

I has two functions to get and save the info that I wanted to persist.....

Public Function ReadRegistrySettings()

    pstrServerName = GetSetting(conApplication, "Database", "ServerName", "MyServer")
    pstrDatabaseName = GetSetting(conApplication, "Database", "DatabaseName", "MyDatabase")
    pstrUserName = GetSetting(conApplication, "Database", "LastUser", "SA")
    pintMainTop = GetSetting(conApplication, "MainForm", "Top", 105)
    pintMainLeft = GetSetting(conApplication, "MainForm", "Left", 105)
    pintMainWidth = GetSetting(conApplication, "MainForm", "Width", 9400)
    pintMainHeight = GetSetting(conApplication, "MainForm", "Height", 5400)
    pintMainSplit = GetSetting(conApplication, "MainForm", "Split", 4245)

End Function

Public Function WriteRegistySettings()

    SaveSetting conApplication, "Database", "LastUser", pstrUserName
    SaveSetting conApplication, "Database", "ServerName", pstrServerName
    SaveSetting conApplication, "Database", "DatabaseName", pstrDatabaseName
    SaveSetting conApplication, "MainForm", "Top", pintMainTop
    SaveSetting conApplication, "MainForm", "Left", pintMainLeft
    SaveSetting conApplication, "MainForm", "Width", pintMainWidth
    SaveSetting conApplication, "MainForm", "Height", pintMainHeight
    SaveSetting conApplication, "MainForm", "Split", pintMainSplit

End Function


the functions populated some global vars, which were used in various places...

' default user name etc
txtUserName.Text = pstrUserName
txtServer.Text = pstrServerName
txtDatabase.Text = pstrDatabaseName


Private Sub SetFormDimensions()

    ' get form dimensions
    ' from global vars
    frmMain.WindowState = vbNormal
    frmMain.Top = pintMainTop
    frmMain.Left = pintMainLeft
    frmMain.Width = pintMainWidth
    frmMain.Height = pintMainHeight
    tvwMain.Width = pintMainSplit
End Sub


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question