Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
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.