MaskedTextBox IP Address

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
How can I get the MaskedTextBox control to take IP addresses based on different octets specified.   I know I can use the format #00.#00.#00.#00, or #99.#99.#99.#99, and Ive even seen ##0.#00.#00.#00.  The format is fine.  The problem that Im having is that I still have to enter in 3 digits per octet, which IPs dont always have 3 digits.

Ultimately, I would like to be able to type in a number or a set of numbers and then go to the next octet by hitting the (.) period key. 

So an example would be if I had to enter three IPs:
1. 192.168.30.2
2. 10.1.1.2
3. 31.23.212.2

So, number one has 3 numbers, but number 2 has only 2.  Right now, the default MaskedTextBox makes you enter in all three numbers before going to the next octet.

How can I format the MaskedTextBox to make it work like I specified?

View the full article
 
Back
Top