10.1.09

To check if number in text box is numeric c#

int resultValue = 0;

if (int.TryParse(textBox1.Text, out resultValue))
{
// It was an integer in the text box
MessageBox.Show(resultValue.ToString());
}
else
{
{
// It was NOT an integer in the text box
}

}

No comments: