IsNumeric(...)in which I was able to know if an entry data was or not a numeric value.
Well, we are not going to find such as kind of function in any library in C# (at least until framework 4), so I wrote a quick version in C#.
Here is the utility function:
private bool IsNumeric(string strEntry)
{
if (strEntry == null)
{
return false;
}
else
{
Regex obj = new Regex("[^0-9]");
return !obj.IsMatch(strEntry) && (strEntry != string.Empty);
}
}
Don't forget to import the following library:
using System.Text.RegularExpressions;
No comments:
Post a Comment