Hello!

Here is a code that shows my local (LAN) IP in a textbox.

'To get local IP address
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)

Me.TextBox1.Text = h.AddressList.GetValue(0).ToString



the code is working, but one warning is generated i.e.

Warning 'Public Shared Function GetHostByName(hostName As String) As System.Net.IPHostEntry' is obsolete: 'GetHostByName is obsoleted for this type, please use GetHostEntry instead.


Then I replaced GetHostByName with GetHostEntry:


'To get local IP address
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)

Me.TextBox1.Text = h.AddressList.GetValue(0).ToString

It works fine with win XP, but in win7 it gives me some weird text...probably mac addres or something.

Question is: How do make it work for win7?

Thanks in advance!