int parsedValue;
if (int.TryParse(txt_number.Text, out parsedValue))
{
//valid Number
// Do something with value
}
else
{
//invalid Number
lbl_error.Text = "Please enter a valid number";
return;
}
if (int.TryParse(txt_number.Text, out parsedValue))
{
//valid Number
// Do something with value
}
else
{
//invalid Number
lbl_error.Text = "Please enter a valid number";
return;
}
No comments:
Post a Comment