I am having some troubles with a masked textbox.
How can I hide those underlines which are shown in the textbox by default?!
Also I want the user be able to enter up to 3 digits (he/she can enter atleast 1 and maximum 3 digits). how to set that?
The MaskedTextBox class is an enhanced TextBox control that supports a declarative syntax for accepting or rejecting user input. Using the Mask property, you can specify the following input without writing any custom validation logic in your application: Required input characters. Optional input characters.
Like the regular text box, the masked text box uses the AsciiOnly property, which indicates whether the control should accept or allow only ASCII characters.
In C#, MaskedTextBox control gives a validation procedure for the user input on the form like date, phone numbers, etc. Or in other words, it is used to provide a mask which differentiates between proper and improper user input.
Set empty space(leave one space) in Promptchar property of masked textbox.
and second answer you already get. or you can put validation on Leave event for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With