I have a combo box that contains 5 items. I have one label on the window. What i would like to do is whenever a user clicks on one of the items in the combobox, text will populate that label. I would like to show information (IP address, etc.) about whichever item is selected. Any help is appreciated. Thanks.
FroglegRank #1,020 · 1.9K reputationPosted Dec 15, 2010, 9:58 AM EST
Create combobox with 3 items cat,dog and cow
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedItem.ToString() == "cat")
{
label1.Text = ("cat");
}
else if (comboBox1.SelectedItem.ToString() == "dog")
{
label1.Text = ("dog");
}
else if (comboBox1.SelectedItem.ToString() == "cow")
{
label1.Text = ("cow");
}
}
label1.text can display any string you want
Sam HobbsRank #107 · 20.5K reputationPosted Dec 15, 2010, 6:35 PM EST
Suthish NairRank #92 · 22.8K reputationPosted Dec 16, 2010, 12:55 AM EST
or something else you looking for.