^[0-9]{0,3}.?[0-9]{1}$
Thanks, T.Saravanan
if(!Regex.IsMatch(txtBox.Text,@"^[0-9]{0,3}.?[0-9]{1}$")) { // Your Error Message } else { // Allow to Next Level }
Private bool IsValidValue() { bool bVal=false; string[ ] sValue=txtBox.Text.Split('.'); try { for(int nlen=0;nlen<sValue.Length;nlen++) { if(int.Parse(sValue[nlen].ToString())>=0) // If you need change this Condition { bVal=true; } } } catch(Exception) { bVal=false } return bVal; }
Login to post response