4

I don't know what this is called, but I'm sure theres a name for this and it has been done multiple times.

I have some textboxes that ideally would only allow specific input, like a box for phone number, bank account numbers and stuff like that.
For instance, a phone number input should be in the following format: 000-000-0000 but I'd also like it to accept a number without an area code like : 000-0000

Now I have made a control derived from textbox that accepts only numeric input, but I have no idea how I would get the dashes to appear in the right spots without doing some fugly hacks in the TextChanged event.

I know this has probably been done to death, I tried to google but I didn't have the right words.

Blue
  • 22,608
  • 7
  • 62
  • 92
Steinthor.palsson
  • 6,286
  • 13
  • 44
  • 51

1 Answers1

7

You should use mask textboxes
there is some free open source mask textboxes

look here

Navid Rahmani
  • 7,848
  • 9
  • 39
  • 57