tags:

views:

34

answers:

1

I have several checkboxes within ToolStripMenuItem within a window form.

I need to setup the registry (I think this automatic when saving, correct?) I need to save the checkboxes into registry (during form.closing event) I need to load the registry and set the checkboxes when form is loaded.

I would like an option to save it to files (save and load) as well.

I read about ConfigurationManager but it look rather complicated (from MSDN source), it this the best solution?. Is there link to simple demo program that done this (to file rather than registry).

A: 

Yes, you really ought to use a Setting. Project + Properties, Settings tab. Add one: Name = Option1Checked, Type = bool, Scope = user, Value = false.

In your form's Load event, you'd write:

  option1ToolStripMenuItem.Checked = Properties.Settings.Default.Option1Checked;

And in the FormClosing event, you'd write:

  Properties.Settings.Default.Option1Checked = option1ToolStripMenuItem.Checked;
  Properties.Settings.Default.Save();
Hans Passant