IPAddress.Parse converts an IP address string to an IPAddress instance.
Imports System
Imports System.Net
Class ParseAddress
Public Overloads Shared Sub Main()
Try
Dim address As IPAddress = IPAddress.Parse("not an IP address")
Console.WriteLine(address.ToString())
Catch e As ArgumentNullException
Console.WriteLine(("Source : " + e.Source))
Console.WriteLine(("Message : " + e.Message))
Catch e As FormatException
Console.WriteLine(("Source : " + e.Source))
Console.WriteLine(("Message : " + e.Message))
Catch e As Exception
Console.WriteLine(("Source : " + e.Source))
Console.WriteLine(("Message : " + e.Message))
End Try
End Sub
End Class