Determine if a Given Value could be an IP Host address

Intelligent Solutions Inc.

Version Compatibility: Visual Basic 6

More information:
This function returns true if the string it is passed could be the address of an IP Host. The string may be in "dotted quad" (e.g., or domain name (e.g., format.

A cool thing about this function is that it contains a 250 element array listing all the currently defined top-level domains (e.g., .com, .org, and all the country codes). If the string to be tested is a domain name, the function does a lookup against this array to determine if the top-level domain name is valid. If you need a list of top level domains for any reason, download this code and save yourself some typing (of course, you will have to keep the list up-to-date as more top-level domains are added).

Note: This function will not work properly for IP hosts on an Intranet, though it could be easily modified for this purpose.

VB 6 is required only because the Split function is used. If you want to use this code in an earlier version of VB, see this article from the Microsoft Knowledge Base, which shows you how to implement Split (and other VB6 specific string functions) in VB 5 and earlier.

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.