Author: bluesky35 (blue) directly call the following function to test the return value of true indicates that the input is a number, not vice versa. ItemValue is the value input. Using System.Text.RegularExpressions; Private Static Bool IsNuMeric (String ItemValue) {Return (IsRegex ("^ (-? [0-9] * [.] * [0-9] {0,3}) $", itemValue ));
Private Static Bool IsRegex (String ItemValue) {
try {Regex regex = new System.Text.RegularExpressions.Regex (regExValue); if (regex.IsMatch (itemValue)) return true; else return false;} catch (Exception) {return false;} finally {}}