Mas que una pregunta os pongo una solucion!
He generado este codigo para mi aplicación y deseo compartirlo con vosotros.
Así que espero que si encontrais algun error, avance o cualquier otra cosa me aviséis y entre todos haremos que sea más facil.
Código:
Un saludo!!! Public Function EsIPCorrecta(ByVal strIP As String) As Boolean Dim arrPartes() As String, i As Long, b As Byte Dim maxValue, myCont As Integer maxValue = 255 myCont = 0 If strIP.Length > 15 Then EsIPCorrecta = False Else arrPartes = Split(strIP, ".") If arrPartes.Length > 4 Then EsIPCorrecta = False Else For i = LBound(arrPartes) To UBound(arrPartes) Try Dim resultado As Integer resultado = CInt(arrPartes(i)) If resultado > maxValue Or resultado < 0 Then MsgBox(arrPartes(i).ToString & " no es un numero entero.", MsgBoxStyle.Exclamation, titleName) EsIPCorrecta = False Exit Function Else myCont = myCont + 1 End If Catch ex As Exception MsgBox(arrPartes(i).ToString & " no es un numero entero.", MsgBoxStyle.Exclamation, titleName) EsIPCorrecta = False Exit Function End Try Next i End If End If If myCont = 4 Then EsIPCorrecta = True Else EsIPCorrecta = False End If End Function