I am trying to get the user's input for picking a colour. I have used a ComboBox
.
How do get the program to see what selection the user has made in order to display it in a MessageBox
? I was thinking of using an if
statement.
string red;
string blue;
string white;
string green;
string purple;
string yellow;
string colour = "";
Use the SelectedIndexChanged event handler.
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show(comboBox1.SelectedItem.ToString());
}