Hello peeps! i'd just like to ask how to put input mask on my textbox just like in ms access or just like a masked box in vb... i'd like put "yyyy/MM/dd" as my input mask for a date field.
Depending on your requirements you can do:
1. Check the text typed in using a regular expression and if it doesn't match then clear text and ask user to retype.
2. Display the mask ..../../.. in the text box and override KeyPress, KeyUp, KeyDown in order to manage the characters typed in e.g. accept only digits and fill the . positions one by one by redisplaying the text in the control.
3. More general,more work to do is to derive ,for example, DateTextBox class from the TextBox class and implement it to accept only the text different date format.
-obislavu-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.