Checkbox Registry Value Please Help
well after searching this forum, I tryed implementing some registry values for my programs, I ahve a problem tho, on form loads, it always ticks check1 box one when the registry's be saved as not ticked, please have a look
Saved to registry when prog closed
Code:
If Check1.Value = vbChecked Then
SaveSetting App.EXEName, "Preferences", "Ontop", "vbChecked"
End If
Form Load, get setting
Code:
If Check1.Value = GetSetting(App.EXEName, "Preferences", Ontop, "vbChecked") Then
Check1.Value = vbChecked
End If
if i close the program and have the checkbox unticked and re open it, it still gives the checkbox a tick, btw, its for a option in my prog to have the form always on top, I bet you guys will crack at it in seconds but im lost :ehh:
Re: Checkbox Registry Value Please Help
Save it as True or False rather than "vbChecked".
Re: Checkbox Registry Value Please Help
save the value directly:
Like David said...
SaveSetting App.EXEName, "Preferences", "Ontop", Check1.Value
Check1.Value = GetSetting( etc....
Re: Checkbox Registry Value Please Help
If the checkbox in unchecked, you don't save any value to the registry, so the old value will still be there. You need to add an Else in you If statements.
Re: Checkbox Registry Value Please Help
Oops - sorry - save it as 0,1,or2
Quote:
CheckBox control — 0 is Unchecked (default), 1 is Checked, and 2 is Grayed (dimmed).
:bigyello:
Re: Checkbox Registry Value Please Help
Save
Code:
SaveSetting App.EXEName, "Preferences", "Ontop", Check1.Value
Retrieve (form load)
Code:
Check1.Value = GetSetting(App.EXEName, "Preferences", "Ontop", "vbChecked"
thank you!, this forum is a blessing, I cant thank you enough :bigyello: