I am trying to get the IP address of my router and so i have found this code and it works perfectly on my pc. When i run it on my laptop however it outputs two addresses. One is the correct one and the other is just 0.0.0.0
I only want it to output the 1 address but i cant figure out how to do it.
Any help would be appreciated.
Dim NetworkAdapters() As NetworkInterface = NetworkInterface.GetAllNetworkInterfaces Dim myAdapterProps As IPInterfaceProperties = Nothing Dim myGateways As GatewayIPAddressInformationCollection = Nothing For Each adapter As NetworkInterface In NetworkAdapters myAdapterProps = adapter.GetIPProperties myGateways = myAdapterProps.GatewayAddresses For Each Gateway As GatewayIPAddressInformation In myGateways MessageBox.Show("Router IP is " & Gateway.Address.ToString) Next Next