Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I am working in a touch screen environment where I am having one screen where i have number buttons 0-9 using which i am entering PIN number of 4 digit.

I changed the MaxLength property of that text box.
when i m entering the value to that text box using keyboard, it's working fine means it is not allowing me to enter more then 4 digits,but when i m entering using the number buttons, it is allowing me to enter more then 4.

Please tell me what is the problem.


Thank you
Posted
Comments
Sergey Alexandrovich Kryukov 5-Jan-15 1:22am    
For the TextBox? Not a problem, but first please tell us: which one? There are different similar but unrelated types under this name. Full type name, please.
—SA

You could try to use the MaskedTextBox Class[^]
It might make it easier to control the input.
 
Share this answer
 
XML
<asp:TextBox ID="txtdigit" runat="server" MaxLength="4"></asp:TextBox>
    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txtdigit" ValidationExpression="^[0-9]+$" runat="server" ErrorMessage="Please enter only numeric value."></asp:RegularExpressionValidator>
 
Share this answer
 
v2
Comments
CHill60 5-Jan-15 4:46am    
OP tagged question with "Windows" which implies that ASP is off topic
what u have written inside the button clicks check that hope ur setting the values directly to the text boxes without checking the length validation
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900