Ex 31. Read an integer value from a textbox (txtValue). Use the TryParse to read the value. Display error message when the value is not valid.
private void btbCheck_Click(object sender, EventArgs e)
{
int value;
if (int.TryParse(textBox.Text, out value))
MessageBox.Show("Valid Input");
else
MessageBox.Show("Invalid Input");
}
}
}

No comments:
Post a Comment