7
Answers

text box validation in c#

Ask a question
venkata kumar

venkata kumar

11y
1.4k
1
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)