Answers for "vb get local ip"

VBA
0

vb get ip address

Private Sub GetIPAddress()

Dim strHostName As String

Dim strIPAddress As String



strHostName = System.Net.Dns.GetHostName()

strIPAddress = System.Net.Dns.GetHostByName(strHostName).AddressList(0).ToString()


MessageBox.Show("Host Name: " & strHostName & "; IP Address: " & strIPAddress)

End Sub
Posted by: Guest on July-19-2020
0

VB get external IP address

Private Function GetExternalIp() As String
    Try
        Dim ExternalIP As String
        ExternalIP = (New WebClient()).DownloadString("http://checkip.dyndns.org/")
        ExternalIP = (New Regex("d{1,3}.d{1,3}.d{1,3}.d{1,3}")) _
                     .Matches(ExternalIP)(0).ToString()
        Return ExternalIP
    Catch
        Return Nothing
    End Try
End Function
Posted by: Guest on January-20-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language