Home All Groups Group Topic Archive Search About

Limit ComboBox entry to ipaddress format

Author
20 Jun 2006 8:27 PM
nt8jbwu02
I would like to allow a user to enter an ip address (quad octet format:
www.xxx.yyy.zzz) in a combo box and then add it to the list when they
have completed the entry.

How can I do this?

The textupdate and textchanged events fire for each keystroke so I
don't think that is the solution.  I was hoping there was an event
which would fire when they completed text entry and hit enter or the
hit the down arrow but no such luck.  I can watch the lost focus event
and check then but I think there is a better solution.

Thanks for your help.

Author
20 Jun 2006 8:37 PM
Ahmed
You can always check the length of the text in the combobox. when it is
15 (including the dots) then you do your validation. Or you can handle
keyup event and check if the pressed key is enter then do your
validation.

Let me know if that solves your issue.

Cheers,
Ahmed

nt8jbw***@sneakemail.com wrote:
Show quoteHide quote
> I would like to allow a user to enter an ip address (quad octet format:
> www.xxx.yyy.zzz) in a combo box and then add it to the list when they
> have completed the entry.
>
> How can I do this?
>
> The textupdate and textchanged events fire for each keystroke so I
> don't think that is the solution.  I was hoping there was an event
> which would fire when they completed text entry and hit enter or the
> hit the down arrow but no such luck.  I can watch the lost focus event
> and check then but I think there is a better solution.
>
> Thanks for your help.
Author
20 Jun 2006 8:41 PM
nt8jbwu02
Ahmed wrote:
> You can always check the length of the text in the combobox. when it is
> 15 (including the dots) then you do your validation. Or you can handle
> keyup event and check if the pressed key is enter then do your
> validation.
>

Thanks for you reply.

I think that is a good start.  However, what about 10.0.0.1, 10.0.0.10,
and 10.0.0.100?

Thanks.
Author
20 Jun 2006 11:20 PM
Ahmed
Are you using .NET 2.0 or 1.1? if you are using 2.0, you can use the
masked Textbox. If you want a drop down what you can do is to have the
masked textbox. Take a look at this site:
http://msdn2.microsoft.com/en-us/library/ka7h9fze.aspx

or you can validate the ip address when the user press on enter.

nt8jbw***@sneakemail.com wrote:
Show quoteHide quote
> Ahmed wrote:
> > You can always check the length of the text in the combobox. when it is
> > 15 (including the dots) then you do your validation. Or you can handle
> > keyup event and check if the pressed key is enter then do your
> > validation.
> >
>
> Thanks for you reply.
>
> I think that is a good start.  However, what about 10.0.0.1, 10.0.0.10,
> and 10.0.0.100?
>
> Thanks.