Search code examples
c#winformsmaskedtextbox

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?


Solution

  • 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.