Wednesday, May 2, 2012

Validating a numeric only textbox

I've created a form based program that need some validation, all I need to to make sure the user can only enter numeric value in the distance text field



So far, I've checked that it's got something in it, if it has something then go on to validate it's numeric



else if (txtEvDistance.Text.Length == 0)
{
MessageBox.Show("Please enter the distance");
}
else if (cboAddEvent.Text //is numeric)
{
MessageBox.Show("Please enter a valid numeric distance");
}




No comments:

Post a Comment