7

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?

Bas
  • 26,772
  • 8
  • 53
  • 86
Dumbo
  • 13,555
  • 54
  • 184
  • 288

2 Answers2

12

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.

Priyank
  • 1,219
  • 11
  • 30
0

I think you'd be better off using a regular TextBox for this. Setting it to allow only digits and max 3 digits are done with properties. Then you just have to check manually that at least one digit exists.

Dan Byström
  • 9,067
  • 5
  • 38
  • 68
  • 4
    No, it's far more easy to use a *MaskedTextBox* and then just modify it to make it look like a regular *TextBox*. Especially for only allowing numeric values a *MaskedTextBox* is perfect. With the regular *TextBox* you'd have to check *KeyPress* (or *KeyDown*) and the paste functions to make sure no non-digit characters can end up in the control. – Alex Dec 02 '15 at 17:08