i've got a list of comboboxes called cb1,cb2,cb3 etc. and a label lb1 lb2 lb3 next to each combobox . the combobox contains 3 values each, low medium and high, and every time a combobox item is selected, theres a label next to the combobox showing a "value",so "low" shows 25, medium shows 50 etc. i managed to have one single routine that controls all the comboboxes, like this:
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ComboBox cb = sender as ComboBox;
string qr = cb.SelectedItem.ToString();
switch (qr) {
case "low":
lb11.Content = "25";
break;
case "medium":
lb11.Content = "50";
break;
case "high":
lb11.Content = "75";
break;
}
i need to change a label next to it according to the combobox name, say the combo is called cb22, i need to change label named lb22 etc.