NetworkInterface.SubnetMask

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As String )
StringValue = aNetworkInterface.SubnetMask

Supported for all project types and targets.

The subnet mask of the user's computer.

Sample Code

The following simple example displays the IP address, Subnet mask, and Mac address for the selected network interface. At start-up, the application detects all the network interfaces installed on the user’s computer and loads them into a PopupMenu. The user then selects the desired network interface and the values are displayed in TextFields.

The PopupMenu's Open event handler is:

Var i As Integer

For i As Integer = 0 To System.NetworkInterfaceCount - 1
PopupMenu1.AddRow(Str(i))
Next

The Change event handler for the PopupMenu is this:

Var n As NetworkInterface

// Get the NetworkInterface object for the selected item
n = System.GetNetworkInterface(Me.SelectedRowIndex)

// Get the MAC Address
MacAddressField.Value = n.MACAddress
// Get the IP Address
IPAddressField.Value = n.IPAddress
// Get the Subnet Mask
SubnetMaskField.Value = n.SubnetMask