Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

app.savesetting 5

Status
Not open for further replies.

Niphyr

Programmer
Jul 21, 2003
85
0
0
AU
what is the command to save settings to your app, such as whether or not a value is true or false. i think it is something like the subject heading but cant seem to get it to work
 
Look up the SaveSetting function in VBHelp

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Never used it before... but...

It appears that you use it like so:

if you have a program named MyProgram with a checkbox (Check1) value that you want to save...

you would say:

SaveSetting "MyProgram", "StartUp", "Check1", Check1.Value

Then to restore the value you could put this in the Form_Load section...

Check1.Value = GetSetting("MyProgram", "StartUp", "Check1", True)

Note the last argument (True) will set the default of the checkbox to True if the Key does not exist in the registery...

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif

 
This is the coolest thing I think I've ever seen. Okay maybe not, but worth a star. Enjoy fellows.

***You can't change your past, but you can change your future***
 
Thanks Wraygun! [smile]

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Yeah,

Thanks for the star, Wraygun!

And thanks for asking, Niphyr...

I had been wondering how to do that myself ;-)

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif

 
They are saved to

HKEY_CURRENT_USER\Software\VB and VBA Program Settings

and for the example
SaveSetting "MyProgram", "StartUp", "Check1", Check1.Value
by CubeE101:

HKEY_CURRENT_USER\Software\VB and VBA Program Settings\MyProgram\StartUp\Check1

What many do not realize, is that you can also branch this out even further:

SaveSetting "MyProgram\Version\6\Build\6951", "StartUp\Type1\ControlName", "Check1", Check1.Value

will store the value in:

HKEY_CURRENT_USER\Software\VB and VBA Program Settings\MyProgram\Version\6\Build\6951\StartUp\Type1\ControlName

 
Now I didn't know that. Have a star CCLINT

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"A computer program does what you tell it to do, not what you want it to do." -- Greer's Third Law
 
WHOA!!! TOO COOL!!!

I, too, have wanted to do just such a thing, but thought it would be over my head at present. (i'm still learning to swim in this VB sea of knowledge)

Ahhh, the learning in this forum is amazing!!! and oh so thrilling!

Thanks again, CCLINT.


Of all the things I've lost, I miss my mind the most!
Sideman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top