Masked C# TextBox Control
Pretty cool snippet by Jibin Pan ;-)
Download Source
The TextBox
control is the most used control in a Windows program. It also cause a lot of problem either from QA or the user because of invalid data that was entered. Using a masked control will save a lot of time for the developer and reduce the complaints and bugs.
This masked intelligent user control enhances the function of the TextBox
control, which can mask the Date, IP Address, SSN, Phone numbers, digits, decimal and checks the validation, and automatically set the delimiter location.
The property Masked is set to None by default and the control works like a normal TextBox control.
If setting the property to DateOnly, the control is masked to Date format.
It is intelligent.
What the user enters |
What is Displayed |
12 | 12/ |
124 |
12/04/ |
13 |
01/3 |
3 |
03/ |
34 |
03/04/ |
14 |
01/04/ |
1/ |
01/ |