That' basically the same as my previous answer: (quantity is taken from the textBox, but can also be taken from the combobox by replacing
textBox2.Text
with
comboBox1.SelectedItem.ToString()
)
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int quantity = 0;
if (!Int32.TryParse(textBox2.Text, out quantity))
{
textBox2.BackColor = Color.Red;
return;
}
if (quantity < 5)
textBox2.BackColor = Color.Green;
else
textBox2.BackColor = Color.White;
}