none
Validate IP address in VB.Net RRS feed

  • Question

  • How can i validate IP address in windows forms application in VB.NET? I have one text box and i want when user write IP to be checked and show if it is corerct or not?
    Tuesday, August 1, 2017 8:12 AM

All replies

  • An IPv4 address is 32bit number. Any number expressed in 32bit is a valid IP. Same applies for IPv6 with 128bit.

    Maybe you want to rephrase your question..

    Tuesday, August 1, 2017 8:26 AM
  • Try the IPAddress class:

    Dim example As String = "123.021.145.200"
    Dim ip As IPAddress
    
    Dim is_valid As Boolean = IPAddress.TryParse(example, ip)
    

    • Proposed as answer by Frank L. Smith Wednesday, August 2, 2017 12:12 AM
    Tuesday, August 1, 2017 11:02 AM
  • How can i validate IP address in windows forms application in VB.NET? I have one text box and i want when user write IP to be checked and show if it is corerct or not?
    A valid IP address is not the same as a correct IP address. As was stated, the IPAddress.TryParse will show if the text represents a valid address. 
    Thursday, August 3, 2017 2:48 PM
  • Hi Elitsa,

    It seems that Viorel_'s reply resolve your issue, if so, please mark it as answer, it will be beneficial to other communities who have the same issue.

    Thanks for your understanding.

    Best Regards,

    Cherry



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 17, 2017 10:01 AM
    Moderator