Reputation: 43
As the titles suggest I am interested in obtaining the value from 4 combo boxes. All 4 combo boxes are the same in the that they list numbers from 0-9. I would like to take those numbers and assigning them to a single string variable. So for example if users selects (CB1 = 4)(CB2 = 3) (CB3 = 2) (CB4 = 1) I would like to take those selection and assign them to a string variable. Thanks in Advance.
-Nogard
Upvotes: 0
Views: 88
Reputation: 4129
if you are using winforms
string s"";
private void combobox1_SelectedIndexChanged(object sender, EventArgs e)
{
s = combobox1.Text+ combobox2.Text+ combobox3.Text+ combobox4.Text;
}
private void combobox2_SelectedIndexChanged(object sender, EventArgs e)
{
s = combobox1.Text+ combobox2.Text+ combobox3.Text+ combobox4.Text;
}
private void combobox3_SelectedIndexChanged(object sender, EventArgs e)
{
s = combobox1.Text+ combobox2.Text+ combobox3.Text+ combobox4.Text;
}
private void combobox4_SelectedIndexChanged(object sender, EventArgs e)
{
s = combobox1.Text+ combobox2.Text+ combobox3.Text+ combobox4.Text;
}
or call only a selected index change event in all comboboxes since all are doing same
Upvotes: 1