|
-
Sep 20th, 2012, 03:09 AM
#1
Thread Starter
Lively Member
[RESOLVED] Local IP Finder not functioning properly in win 7
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|