Click here to Skip to main content
Licence 
First Posted 8 Sep 2005
Views 68,357
Downloads 3,482
Bookmarked 39 times

IP TextBox

By mawnkay | 8 Sep 2005 | Unedited contribution
An IP textbox control that mimics ip boxes in windows network settings
1 vote, 7.7%
1
1 vote, 7.7%
2
1 vote, 7.7%
3
4 votes, 30.8%
4
6 votes, 46.2%
5
4.12/5 - 13 votes
1 removed
μ 3.39, σa 2.09 [?]

Introduction

This simple IP address textbox replaces the lack of an IP box in Windows Forms control. Using the DLL you can just add the control to your toolbox and its use is very similar to a regular TextBox control.

Background (optional)

While writing an application for some end-users, i had the need for a textbox that only took an ip address and performed some validation to make sure the text entered was actually an IP. Since there was nothing readily availible that did what I wanted, I wrote a control that can easily be added to any .NET Windows Form.

Using the code

Using this control is very easy. Just right-click somewhere in your toolbox, then click "Add/Remove Items...". Now browse to the DLL, click OK and the control should now be in your toolbox. The control inherits the standard TextBox in Windows.Forms and overrides the Text property so that you can programmatically set or get the Text value as a string; I also added a method IsValid() which returns true if the Text property falls in the parameters of an actual IP address and false otherwise;

Points of Interest

The control is actually 4 TextBoxs and 3 Labels with "." placed at the appropriate locations. Most validation is done on KeyPress and currently a MessageBox pops up to alert the user of Invalid inputs such as numbers less than 0 or greater than 255.

History

No history yet, but thinking of being able to turn off the MessageBox warnings. There also is no validation when setting the Text programmatically and an unhandled exception is thrown.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

mawnkay

Web Developer

United States United States

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 2 Pinmemberi0013:47 18 Jan '12  
GeneralMy vote of 5 PinmemberDonaldKnuth23:45 29 Oct '11  
GeneralNeed PinmemberHardikasd2:23 25 Feb '10  
GeneralNice PinmemberMember 33287121:59 1 Dec '09  
GeneralNew code update Pinmembersysx8:33 19 Nov '09  
QuestionRegarding IP textbox Pinmemberrajionline18:55 20 Sep '07  
GeneralCheck IP Textbox if it's filled with a ip address PinmemberLuneto_HA4:38 20 Mar '07  
GeneralRe: Check IP Textbox if it's filled with a ip address Pinmemberavramik21:20 14 Jun '10  
GeneralDataBinding Pinmemberjoelthegeek6:31 1 Dec '05  
GeneralMovement needs to be a little better Pinmemberluniv040410:26 8 Nov '05  
GeneralRe: Movement needs to be a little better Pinmemberjoelthegeek4:32 1 Dec '05  
GeneralNice Control ! A little question :doh: PinmemberFredyAlfredo3:25 20 Sep '05  
GeneralRe: Nice Control ! A little question :doh: Pinmembermawnkay5:16 27 Sep '05  
AnswerRe: Nice Control ! A little question :doh: Pinmembermawnkay5:44 4 Oct '05  
GeneralLittle changes PinmemberMansonP3:48 15 Sep '05  
GeneralRe: Little changes Pinmembermawnkay5:21 27 Sep '05  
GeneralRe: Little changes Pinmemberpinquotriot13:27 19 Mar '09  
General2 comments: PinmemberMadHatter ¢10:33 8 Sep '05  
GeneralRe: 2 comments: Pinmembermalharone16:23 8 Sep '05  
GeneralRe: 2 comments: PinmemberMadHatter ¢18:25 8 Sep '05  
GeneralRe: 2 comments: Pinmembermawnkay5:41 9 Sep '05  
GeneralRe: 2 comments: PinmemberMadHatter ¢8:33 9 Sep '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120209.1 | Last Updated 8 Sep 2005
Article Copyright 2005 by mawnkay
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid