Solved

How to reloan the setting from last time??

Posted on 2002-06-28
2
157 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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now