I have unformatted text in my SQL 2005 database. I'm pulling it into a masked edit text box with a (999)999-9999 mask. Unfortunately, when I attempt to save the data back it doesn't work because I don't know how to get the 'masked' information back to the 'unmasked' raw data that the database wants.
Data in Masked Edit Text Boxes
Collapse
X
-
I'm not a VB guy (C# spoken here).
But I can give you my C# function for checking if a string is a number, via RegEx.
I send one character at a time of my entire string. The function returns true or false. If it is true, then I can add that one character to my final string. If not, I can ignore itCode:// Source Code starts /* <HowToCompile> csc /r:System.Text.RegularExpressions.dll,System.dll Validation.cs </HowToComplie> */ // Function to test for Positive Integers. public static bool IsNaturalNumber(String strNumber) { Regex objNotNaturalPattern = new Regex("[^0-9]"); Regex objNaturalPattern = new Regex("0*[1-9][0-9]*"); return !objNotNaturalPattern.IsMatch(strNumber) && objNaturalPattern.IsMatch(strNumber); }Comment
Comment