<div class="meta" robots="noindex">

</div>

Method

# System.GetNetworkInterface

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `System.NetworkInterface<system.networkinterface>` as a replacement.

</div>

## Description

Use the `NetworkInterface</api/networking/networkinterface>` object to obtain networking information about the user's computer.

## Notes

Use the optional parameter to specify the network interface card. *Index* is zero-based. If *Index* is out of bounds, an `OutOfBoundsException</api/exceptions/outofboundsexception>` is raised. NetworkInterfaceCount gives you the number of network interfaces in the 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</api/deprecated/popupmenu>`. The user then selects the desired network interface and the values are displayed in `TextFields</api/deprecated/textfield>`.

The `PopupMenu's</api/deprecated/popupmenu>` Open event handler is:

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

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The Change event handler for the `PopupMenu</api/deprecated/popupmenu>` is this:

``` xojo
Sub Change()
  If Me.ListIndex > -1 Then
    ' Get the NetworkInterface object for the selected item
    Dim iface As NetworkInterface = System.GetNetworkInterface(Me.ListIndex)
    MacAddressField.Text = iface.MACAddress
    IPAddressField.Text = iface.IPAddress
    SubnetMaskField.Text = iface.SubnetMask
  End If
End Sub
```

## Compatibility

All project types on all supported operating systems.
