venkata kumar

venkata kumar

  • NA
  • 537
  • 172.8k

text box validation in c#

Aug 29 2013 8:48 AM
hi
can any body help

the fallowing code i can able to enter data 250.00 in text box

if (e.KeyChar == '.' && (sender as TextBox).Text.IndexOf('.') > -1)
            {
                e.Handled = true;
            }
            if (!char.IsControl(e.KeyChar))
            {
                TextBox tt = (TextBox)sender;
                if (tt.Text.IndexOf('.') > -1 && tt.Text.Substring(tt.Text.IndexOf('.')).Length >= 3)
                {
                    e.Handled = true;
                }
            }

 after enter 250.00  this i changes to 25.00 by using back. after that  i am not able to  enter any number.

Answers (7)