|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Converting IP Address as string to MyIP as IPAddressHow do I convert "192.168.0.200" (as type string) to MyIP (as type
IPAddress)? -Jerry "Jerry Spence1" <jerry.spe***@somewhere.com> wrote in message Example (uses a textbox to enter the address, but you get the idea...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)? > IPAddress OutAddr; if (IPAddress.TryParse(textBox1.Text, out OutAddr) == false) { MessageBox.Show("Address is not valid!", "Error"); return; } else { MessageBox.Show(OutAddr.ToString()); }
Show quote
Hide quote
"james" <ja***@com.com> wrote in message Forgive me - thought I was in the C# group - but the same process should 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()); > } apply (give or take) Show quoteHide quote > "IdleBrain" <indianmostwan***@yahoo.com> wrote in message Ah! Thanks very much indeed.news:1148661889.544986.72190@j55g2000cwa.googlegroups.com... > Jerry, > Try > ipAddr = IPAddress.Parse("192.168.0.200") > > Hope it solves.. -Jerry |
|||||||||||||||||||||||