Converting IP Address as string to MyIP as IPAddress

  • Thread starter Thread starter Jerry Spence1
  • Start date Start date
J

Jerry Spence1

How do I convert "192.168.0.200" (as type string) to MyIP (as type
IPAddress)?

-Jerry
 
Jerry Spence1 said:
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());
}
 
james said:
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)
 
Back
Top