Hind Najim

Hind Najim

  • NA
  • 32
  • 18.1k

Save default settings for comboBoxes

Sep 6 2013 8:38 AM

Hi


I have multiple comboBoxes each populates same options.

For example:


string[] Items = { "Name", "ID", "Country", "Address", "Age", "Gender" };
string[] mySelectedItems = new string[4];

In the form_load
{

Cb1.Items.AddRange(Items);
Cb2.Items.AddRange(Items);
Cb3.Items.AddRange(Items);
Cb4.Items.AddRange(Items);

SelectedItems[0] = Items[1];
SelectedItems[1] = Items[0];
SelectedItems[2] = Items[2];
SelectedItems[3] = Items[5];

}

If I selected different option from each comboBox, Lets say:
Country from cb1 , Name from cb2 and ID from cb3.

Then, If I'd like to save this current selections to be used like a default settings whenever my application runs next time. then maybe I need to save the selection on array and in the forom_load I'll set a condition to run one of those two settings. But what is the condition on this case?

Or maybe i need to save the current settings and give a name for the setting, and when I need to use this setting, I just need to select the name and press on load button.

for this, where to save the selection and give a name so that I can load later? Do I need a DB? Still beginner in coding.


Answers (5)