Google Gruppi non supporta più i nuovi post o le nuove iscrizioni Usenet. I contenuti storici continuano a essere visibili.

get ip address of this pc with windows app

172 visualizzazioni
Passa al primo messaggio da leggere

cj

da leggere,
15 mar 2007, 14:07:0115/03/07
a
How can a windows app get the ip address of the machine it is running
on? vb 2005

Newbie Coder

da leggere,
15 mar 2007, 14:50:0715/03/07
a
CJ,

This is how to get the internal IP address:

Imports System.Net

Dim ipAddress As IPHostEntry = Dns.GetHostByName(Dns.GetHostName)
Me.Text = ipAddress.AddressList.GetValue(0).ToString

I hope this helps,

--
Newbie Coder
(It's just a name)


cj

da leggere,
16 mar 2007, 10:21:3616/03/07
a
had to change it a bit but it works

Dim ipAddressInfo As IPHostEntry = Dns.GetHostEntry(Dns.GetHostName())
Dim ipAddress As String = ipAddressInfo.AddressList.GetValue(0).ToString

Walter Wang [MSFT]

da leggere,
19 mar 2007, 21:55:3519/03/07
a
Hi CJ,

You're right that Dns.GetHostByName is obsolete in .NET 2.0,
Dns.GetHostEntry should be used instead.

Regards,
Walter Wang (waw...@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

0 nuovi messaggi