Martin Racette said:
Thank you for the information, but I do not how I can pass the IP address
so that can find out the name that is associated with it
If you could clarify how to build such a function I would appreciated.
BTW I did check the online help, and I just get more confuse by it
Ok, I have just done a little coding. To run it, you'll need a form and a
button (form1 and button1).
Imports System.Net
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'With the next line you choose the IP address you want to test.
Dim myBytes() As Byte = {192, 168, 0, 241}
Dim TestIP As New IPAddress(myBytes)
Dim msg As String = ""
Dim ComputerName As String = ""
ComputerName = IP_to_Name(TestIP)
Select Case ComputerName.Length
Case 1 To 99
msg = "The computer with the IP Address " & TestIP.ToString
& " is named : " & ComputerName
Case 0
msg = "IP Address " & TestIP.ToString & " is not online at
the moment."
End Select
MsgBox(msg)
End Sub
Private Function IP_to_Name(ByVal an_IP_address As IPAddress) As String
Try
Return Dns.GetHostEntry(an_IP_address).HostName
Catch ex As Exception
'MsgBox(ex.ToString)
Return ""
End Try
End Function
End Class