How to write the code for Decimal Number and after decimal point it allows only two numbers.
  • hi coders to day i have to share How to write the code for Decimal Number and after decimal point it allows only two numbers.
    I hope it will use your code    
    Here i write by common method you can use it wherever you need it 
    if (e.KeyChar >= '0' && e.KeyChar <= '9' || e.KeyChar == 8 || e.KeyChar == 46)
                    e.Handled = false;
                else
                    e.Handled = true;
                if ((sender as TextBox).Text.Contains('.') && e.KeyChar == '.')
                    e.Handled = true;
                if (Regex.IsMatch((sender as TextBox).Text, @"\.\d\d"))
                {
                    e.Handled = true;
                }

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

Top Posters Weekly

Optimum Creative