Varunice

Hi All,

Am new to this group and also am a beginner in .net development. I'v a doubt which i thought would be cleared here as many experts are members of this forum.

My doubt goes here : Am working with a proj in vb.net and c#.I need to have a textbox which gets IP address.Is there a way to use IP Address text box. (text box with "." as separators) is any API available or should i write code.

This might be a basic doubt for many of the members.but am a beginner.so, please help me out




Re: Visual Basic Language IP Address textbox

Dick Donny

Hi

As a starter, I'd recommend you download an example of how to do this and trawl through the code. If you have specific questions thereafter, please feel free to post them

http://www.codeproject.com/cs/miscctrl/IPAddressTextBox.asp

Richard

PS - Example is in C# but easy to follow.





Re: Visual Basic Language IP Address textbox

Joshua Morgan

Here is a vb.net example:

http://www.freevbcode.com/ShowCode.asp ID=4859






Re: Visual Basic Language IP Address textbox

Frank Carr

The real easy way. Use the Masked Text Box control with this mask property ###.###.###.### and use the Validation event to confirm that the value entered is a valid IP address.




Re: Visual Basic Language IP Address textbox

Ken111

>Use the Masked Text Box control with this mask property ###.###.###.### and use the
> Validation event to confirm that the value entered is a valid IP address.

I ran into this same problem, I tried with
###.###.###.### but it force me to enter
192.168.000.001 for my IP address instead of 192.168.0.1

Is there a more flexible mask option to accept 1 - 3 in between "."

Thanks





Re: Visual Basic Language IP Address textbox

Frank Carr

You should be able to type in 192.168.0.1 with this mask "###.###.###.###" and have it validate as correct input. Do you have any other validating code

The only hitch I've noted is that you'll have spaces in the Text value of the control in that you'll need to clear out. You can use the Replace property of the string to do this:

Code Snippet

IPAddress = MaskedTextBox1.Text.Replace(" ", "")