Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to record a value to a property at runtim
Message
From
24/12/1998 15:37:18
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00170090
Message ID:
00170387
Views:
24
>>>Hi all,
>>>
>>>I wonder if this is possible. Basically, I'd like to record in one of the form's properties a value that is selected by the user and not having to record that in a table, but in the actual form's table (this is at runtime). I know the property must be initialized, so the idea is, in the next session the user will have as default value what was selected in a previous session.
>>>
>>>Thanks,
>>>
>>>
>>>Gil
>>
>>I did this some time ago. When each user runs my exe, it needs to present them with the value they entered last time. Each user then runs the same exe with their own value in it. My solution: API call to the registry - worked perfect!
>
>Nigel,
>
>I've never done API calls to the registry to write a value, but the idea really intrigues me. Do you have any samples that I could take a look at or pointers to sites that have them?. The registry is one of those mysterious "I-don't-want-to-mess-with-it-because-Microsoft-does" kind of areas, but I'll definitely want to give a try.
>
>
>Merry Christmas,
>
>
>Gil

Gil, reading and writing values to and from the registry is really easy once you have the semantics of the API calls out of the way. There are a couple of really good registry classes available here for download- I use Rick Strahl's currently but any will work fine.
Using a class like this allows you to make calls to the registry basically like

oReg.WriteValue(HKEY_CURRENT_USER, "Software\MyCompany\MyProgram\MyVersion\Settings","CustomStoredVal",THISFORM.MyProperty)

AND

oReg.ReadValue(HKEY_CURRENT_USER, "Software\MyCompany\MyProgram\MyVersion\Settings","CustomStoredVal")

or something like that.

Once you are comfortable with it, you can integrate it into your framework and build form that remember their size and position, as well as any other user preferences.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform