A Digital Age Deserves A Digital Leader

IP Address

IP Address

Postby jonnywright » Sat Oct 18, 2003 4:00 pm

Does anyone know how to display your IP in VB.NET? I got this code from abstractvb but it dosent work :cry:

'Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)
TextBox1.Text(CType(h.AddressList.GetValue(0), IPAddress).ToString)'

But 'IPAddress' (in italics) is underlined blue and says 'Type 'IPAddress' is not defined.' Can someone please help or tell me another way to find my IP using VB.NET?
Thanks

-Jonny
Banned
User avatar
Posts: 53
Joined: Thu Aug 14, 2003 10:25 pm
Location: Leicester UK

Postby Mac33 » Sat Oct 18, 2003 4:32 pm

Hi Jonny
One of our staff may be able to help you there, but he is not on board at the moment. No doubt he will pick this up later. :yesnod:
PROfessional Member
User avatar
Posts: 4910
Joined: Tue Mar 12, 2002 4:55 pm
Location: Scotland

Postby Injunfarian » Sat Oct 18, 2003 6:40 pm

of first you need to import System.Net, System.Net.Sockets


then to go with your code
Dim IPAddress As New IPAddress(Dns.GetHostByName(Dns.GetHostName).AddressList(0).Address)
TextBox1.Text(IPAddress.ToString)
<a href="http://www.secretsofwar.net/index.asp?referer=injunfarian" target=_blank>Good Webbased Game</a>

<a href="http://selectaz.com" target=_blank><img src="http://selectaz.com/popup/stats.php" border=0></a>
PRO Level 3
User avatar
Posts: 63
Joined: Sat Jan 18, 2003 8:15 pm

Postby jonnywright » Sat Oct 18, 2003 6:50 pm

Injunfarian, extremely grateful! Thank you very much, it was really starting to get on my nerves! ^*^
Nice one!

-Jonny
Banned
User avatar
Posts: 53
Joined: Thu Aug 14, 2003 10:25 pm
Location: Leicester UK

Postby Injunfarian » Sat Oct 18, 2003 6:51 pm

np.
<a href="http://www.secretsofwar.net/index.asp?referer=injunfarian" target=_blank>Good Webbased Game</a>

<a href="http://selectaz.com" target=_blank><img src="http://selectaz.com/popup/stats.php" border=0></a>
PRO Level 3
User avatar
Posts: 63
Joined: Sat Jan 18, 2003 8:15 pm

Postby Mac33 » Sat Oct 18, 2003 7:27 pm

:thumbs:
PROfessional Member
User avatar
Posts: 4910
Joined: Tue Mar 12, 2002 4:55 pm
Location: Scotland

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 1 guest