Calculate The Subnet Mask From an IP Range

Category:
Network/Internet
Type:
Snippets
Difficulty:
Intermediate
Author:
Anonymous

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
Insert the first and last IP address of your range and it will calculate the subnet mask that fits these values with the starting and ending address for this subnet. Usage: Dim MySubnet as String MySubnet = CalculateSubnetMask("192.168.91.254","192.168.90.0")

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: