Click here to Skip to main content
Sign Up to vote bad
good
Plz help me how to validate a masked textbox for an ip address like this ###.###.###.###? how can i enter 194.5.6.222? without having to enter it as 184.005.006.222?
Posted 31-Jan-13 8:02am
Iman90265

Comments
JemiM - 31-Jan-13 14:07pm
please put a nice heading for the question.
Sergey Alexandrovich Kryukov - 31-Jan-13 14:09pm
Also, Tag your UI library or application type. And, no matter how you do it, you always need to enter or select those integers, isn't that obvious? Tag the UI you use; and you will get help almost immediately. —SA
Dave Kreskowiak - 31-Jan-13 20:59pm
You neeeeeeeed to GROW UP and stop using childish language and txtspeak. You've got full keyboard in front of you. Use it! If you want people to take you seriously, you'll do this.

1 solution

I wouldn't use a masked edit box for this - they are really only usefull for fixed input format, not flexible ones as you need.
Instead, I would use a standard TextBox and a regex to validate it:
^(?<first>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?<second>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?<third>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?<fourth>2[0-4]\d|25[0-5]|[01]?\d\d?)$</fourth></third></second></first>
  Permalink  
Comments
Sergey Alexandrovich Kryukov - 31-Jan-13 14:10pm
It's only OP thinks that validation is needed, but really it's about a masked text box or other input method... —SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 6,824
1 Prasad_Kulkarni 3,671
2 _Amy 3,312
3 OriginalGriff 3,309
4 CPallini 2,925


Advertise | Privacy | Mobile
Web04 | 2.6.130617.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid