How to validate an IP address

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sanvitha
    New Member
    • Jun 2007
    • 1

    How to validate an IP address

    Hi! I am still learning VB 6.
    I have a problem about the validation of IP address.
    Please help me to do it. If You can send me the vb code for validate IP address.


    Thank You very much.Have a nice day.
  • ansumansahu
    New Member
    • Mar 2007
    • 149

    #2
    Originally posted by sanvitha
    Hi! I am still learning VB 6.
    I have a problem about the validation of IP address.
    Please help me to do it. If You can send me the vb code for validate IP address.


    Thank You very much.Have a nice day.
    Hi ,

    Check this function out.

    Function IsValidIp(strIp Address)
    Dim aTmp
    IsValidIp = False
    aTmp = Split(strIpAddr ess, ".")
    ' There must be 4 fields in a valid IP
    If UBound(aTmp) <> 3 Then Exit Function
    For Each field In aTmp
    If field > 255 Then Exit Function
    Next
    IsValidIp = True
    End Function

    good luck
    -ansuman sahu

    Comment

    Working...