|
-
March 30th, 2001, 08:48 AM
#1
SETTINGS
Does anyone know how to easily save the settings for each object on a form (either into registry or ini) so that if for eg. someone changes the background color it is stored.
As I need to save about 10 settings per object and I have up to 20 objects on a form and I may have 30 forms, saving each setting individually is not practical.
What l need is a module that allows me to simply send through the formname and have the module loop through all the settings on each form.
-
March 30th, 2001, 09:43 AM
#2
Re: SETTINGS
Use WriteProfileString and GetProfileString to read and write values to the registry.
Yes, you can write a function that takes a form as an argument as follows
public Sub SaveParams(aForm as Form)
dim aControl as Controls
for each aControl in aForm.Controls
'You can access the properties of the control using aControl.PropertyName
'And Concatenate them into a string
next
'Finally save the string using WriteProfileString here
End Sub
-
March 30th, 2001, 09:20 PM
#3
Re: SETTINGS
This is the problem, each control has different properties (or settings), so specifing each property for each control on every form would require 100's of lines of code. I need to be able to loop through the properties, not just the controls.
Thanks for your help.
-
March 30th, 2001, 11:54 PM
#4
Re: SETTINGS
Just use a superset of all properties, I mean, save all properties that you can think of, without concerning whether a control has it or not. It is sure that you'll get an error, but it doesn't matter, use an On Error Resume Next. It is a crude method however.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|