Solved

How to reloan the setting from last time??

Posted on 2002-06-28
2
159 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

803 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