Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Masked TextBox how to not show underlines in text box and allow user to enter 3 digits

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?

like image 485
Saeid Yazdani Avatar asked Oct 26 '11 08:10

Saeid Yazdani


People also ask

How do you mask a TextBox?

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.

Which property is used for masking text in TextBox control?

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.

What is masked TextBox in C#?

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.


1 Answers

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.

like image 85
Priyank Avatar answered Sep 23 '22 08:09

Priyank