But, the Mask must accept two kinds of mask, like, the default mask is like this (00) 0000-0000, but sometimes the mask need to have one more slot, like this (00) 0000-00000. If the user type more than 10 chars, the Masked Text Box will change his own mask.
C maskedtextbox validating
I specified LL for the state abbreviation in the mask (BTW, I would like to validate that using a (pardon me) "if string is AK || AL || etc" check if possible), so there's no way to enter anything but letters.
However, for the ZIP code, I had to trucate to five digits in my textbox, because trying to parse the field to int always fails (I think because of the hyphen).
I'm having similar problems with the telephone number.
SO, my question is this: How do I validate user data in a masked text box when the mask itself includes (, ), and - ?
Forms; namespace Masked Text Box Hi, Why don't you derive the Control from Masket Text Box itself and then the control can have properties which you can customise on the form. What I made is a Custom Control, where I added a Masked Text Box, and then, coding some events.
I'm working on a class assignment that has us writing an ordering application for a tea company. I'm using a masked textbox control for the state abbreviation, telephone number, and ZIP 4 code.
These characters seem to be getting included in the check, which is not what I want. We haven't covered those in class yet, and I want to stick with things I understand.
We have covered try/catch, tryparse, and switch cases, but none of those seem appropriate for this problem.
If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Masked Edit applies a "mask" to the input that permits only certain types of characters/text to be entered.
The supported data formats are: Number, Date, Time, and Date Time.
The current text in the control will be validated either when the user leaves the control.