Check for IsNumeric

Whenever a programmer/developer is working with forms/profiles, validation is necessary. Here, i would like to share you codesnippet for 'isNumeric' validation.

Just add this function in your application core library(public class), so that you can access anywhere in your application thru reference.


public static bool IsNumeric(string value)
{
if (String.IsNullOrEmpty(value) == false)
{
for (int i = 0; i < value.Length; i++)
{
if (Char.IsNumber(value, i) == false)
{
return false;
}
}

return true;
}
else
{
return false;
}
}


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: