Thursday, December 22, 2011

Snippet: Validating whether a string is integer or not

bool bInt;
int intValue;
bInt = int.TryParse(strData, out intValue);
if (bInt == true)
{
  // Successfully parsed
}
else
{
  // String is in numeric format
}

No comments:

Post a Comment