Home All Groups Group Topic Archive Search About

Converting IP Address as string to MyIP as IPAddress

Author
26 May 2006 3:09 PM
Jerry Spence1
How do I convert "192.168.0.200" (as type string) to MyIP (as type
IPAddress)?

-Jerry

Author
26 May 2006 4:06 PM
james
"Jerry Spence1" <jerry.spe***@somewhere.com> wrote in message
news:44771a2b$0$550$ed2619ec@ptn-nntp-reader01.plus.net...
>
> How do I convert "192.168.0.200" (as type string) to MyIP (as type
> IPAddress)?
>

Example (uses a textbox to enter the address, but you get the idea...

IPAddress OutAddr;
if (IPAddress.TryParse(textBox1.Text, out OutAddr) == false)
{
    MessageBox.Show("Address is not valid!", "Error");
    return;
}
else
{
    MessageBox.Show(OutAddr.ToString());
}
Author
26 May 2006 4:07 PM
james
Show quote Hide quote
"james" <ja***@com.com> wrote in message
news:447726d5$0$28774$db0fefd9@news.zen.co.uk...
>
> "Jerry Spence1" <jerry.spe***@somewhere.com> wrote in message
> news:44771a2b$0$550$ed2619ec@ptn-nntp-reader01.plus.net...
>>
>> How do I convert "192.168.0.200" (as type string) to MyIP (as type
>> IPAddress)?
>>
>
> Example (uses a textbox to enter the address, but you get the idea...
>
> IPAddress OutAddr;
> if (IPAddress.TryParse(textBox1.Text, out OutAddr) == false)
> {
>    MessageBox.Show("Address is not valid!", "Error");
>    return;
> }
> else
> {
>    MessageBox.Show(OutAddr.ToString());
> }

Forgive me - thought I was in the C# group - but the same process should
apply (give or take)
Show quoteHide quote
>
Author
26 May 2006 4:44 PM
IdleBrain
Jerry,
Try
ipAddr = IPAddress.Parse("192.168.0.200")

Hope it solves..
Author
27 May 2006 5:24 AM
Jerry Spence1
"IdleBrain" <indianmostwan***@yahoo.com> wrote in message
news:1148661889.544986.72190@j55g2000cwa.googlegroups.com...
> Jerry,
> Try
> ipAddr = IPAddress.Parse("192.168.0.200")
>
> Hope it solves..

Ah! Thanks very much indeed.
-Jerry