Check the page "Managing Application Settings":
http://msdn2.microsoft.com/en-us/library/c9db58th.aspx
More specifically, "How to: Add or Remove Application Settings":
http://msdn2.microsoft.com/en-us/library/25zf0ze8.aspx
Or you can roll your own, such as is done here:
http://www.codeproject.com/vb/net/ConfigOpt.asp
and in many other examples you can find on the web.
You will probably want to save the setting in the _FormClosing
event (while the checkbox control is still alive and well).
Make sure you restore the value in the checkbox after the
checkbox has been created and initialized. Also, make sure
that setting the value through code does not trigger any unwanted
side-effects, i.e. event handlers for the checkbox should know
that the value has been set through code instead of as the result
of a user action.
As for using SaveSetting: Are you sure you want to do this?
SaveSetting will store the value in the Registry at
HKEY_CURRENT_USER\Software\VB and VBA Program Settings.
It is a leftover from the bad old "classic" VB days and I do not
think it should be used in any new .Net code, except if compatibility
with old applications is needed.
/JB
On Sun, 25 Dec 2005 17:43:27 +0700, "Laserson" <la******@inbox.ru>
wrote:
Hi! I have one question about SaveSetting() function. I have one checkbox
and i want to save it's state on form closing and then restore it on form
loading. How can i make it?