validate an IP Address? i'm sure .NET has something like that.
Printable View
validate an IP Address? i'm sure .NET has something like that.
Umm
VB Code:
Private Sub ValidateIP(ByVal IP As Object) Try Dim IpObject As Object = Net.IPAddress.Parse(IP) If IpObject.ToString = Net.IPAddress.Parse(IP).ToString Then MessageBox.Show(IpObject.ToString + " Valid IP Address") End If Catch ex As Exception MessageBox.Show("Invalid IP Address") End Try End Sub
Usage
VB Code:
1-valid IP ValidateIP("20.102.255.5") 2-Invalid ValidateIP("20.102.255.256")
Just to add a note:
In case you need to validate IPv6 you need to enable its support both in machine.config and in your OS.