We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Imports System.Net Public Class Form1 Function ReturnLocalIP(ByVal Type As Net.Sockets.AddressFamily) As String 'Pass "Net.Sockets.AddressFamily.InterNetwork" for IPv4 'Pass "Net.Sockets.AddressFamily.InterNetworkV6" for IPv6' Dim HostEntry As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName) For Each IP As Net.IPAddress In HostEntry.AddressList If IP.AddressFamily = Type Then Return IP.ToString End If Next Return "NULL" End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = ReturnLocalIP(Net.Sockets.AddressFamily.InterNetwork) End Sub End Class
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.