Detect Local IP Address in Visual Basic 2005 Express Edition (Beta 2)
I'm trying to write a simple program in my newly downloaded copy of Visual Basic 2005 Express Edition (Beta 2).
I want to display the IP address of the local machine (i.e. the machine the program is being run on).
I would previously have used something like this:
Imports
System.Net
Imports System.Net.Sockets
Dim IPAddressAsNew IPAddress(Dns.GetHostByName (Dns.GetHostName).AddressList(0).Address)
Dim strIPAddressAsString = IPAddress.ToStringHowever, this now displays a warning that this format has now been depracted and to useIPAddress.Equals method instead.
Could anyone shed any light on how to get my local IP address in VB 2005 Express (Beta 2)?
Many thanks.
I have wondered the same thing, but not only do i want to get the IPAddress, but the subnet address as well.
I was wondering why you cant say something like this
Dim IPAddress As IPAddress = My.Computer.Network.IPAddress
One thing i already know is that there is no IPAddress in the namespace of My.Computer.Network
I was wondering why not.