I'd recommend changing your TextBox to a NumericUpDown (called numAge), if possible. Go to the properties of the NumericUpDown in the Form editor and click the Events button (lightning bolt). If you double-click the ValueChanged option, it will create the stub for the following method:
private void numAge_ValueChanged(object sender, EventArgs e)
{
if (numAge.Value > 0 && numAge.Value < 13)
{
// Child
// Highlight label
}
else if (numAge.Value > 12 && numAge.Value < 16)
{
// Pre-Teen
// Highlight label
}
else if (numAge.Value > 15 && numAge.Value < 19)
{
// Teen
// Highlight label
}
else if (numAge.Value > 18)
{
// Adult
// Highlight label
}
else
{
// Clear the highlights
}
}
If you must use a TextBox, use the TextChanged method. That way you don't need the Submit Button:
private void txtAge_TextChanged(object sender, EventArgs e)
{
int txtAgeValue = 0;
if (!string.IsNullOrWhiteSpace(txtAge.Text))
{
txtAgeValue = int.Parse(txtAge.Text);
}
if (txtAgeValue > 0 && txtAgeValue < 13)
{
// Child
// Highlight label
}
else if (txtAgeValue > 12 && txtAgeValue < 16)
{
// Pre-Teen
// Highlight label
}
else if (txtAgeValue > 15 && txtAgeValue < 19)
{
// Teen
// Highlight label
}
else if (numAge.Value > 18)
{
// Adult
// Highlight label
}
else
{
// Clear the highlights
}
}