I am making a BMI calculator. I want to get the value of the text box so I can change the colour of the text in the textbox accordingly how do I do that?
int value;
if (int.TryParse(textBox1.Text, out value))
{
if (value > 20)
textBox1.ForeColor = Color.Red;
}
else
{
// user entered something that's not a number
}
int value;
if (int.TryParse(textBox1.Text, out value))
{
if (value > 20)
textBox1.ForeColor = Color.Red;
}
else
{
// user entered something that's not a number
}