Solved

How to reloan the setting from last time??

Posted on 2002-06-28
2
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: 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

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

751 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