Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Whats My IP Address ?

5.00/5 (2 votes)
21 Sep 2011CPOL 6.2K  
Private Sub GetIPAddress()Dim strHostName As StringDim strIPAddress As StringstrHostName = System.Net.Dns.GetHostName()strIPAddress = System.Net.Dns.Resolve(strHostName).AddressList(0).ToString()MessageBox.Show(Host Name: & strHostName & ; IP Address: &...
VB
Private Sub GetIPAddress()

Dim strHostName As String

Dim strIPAddress As String



strHostName = System.Net.Dns.GetHostName()

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



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

End Sub

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)