"Martin Racette" wrote:
>
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(B yVal sender As System.Object, ByVal e As
System.EventArg s) 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(myByt es)
Dim msg As String = ""
Dim ComputerName As String = ""
ComputerName = IP_to_Name(Test IP)
Select Case ComputerName.Le ngth
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(ByVa l an_IP_address As IPAddress) As String
Try
Return Dns.GetHostEntr y(an_IP_address ).HostName
Catch ex As Exception
'MsgBox(ex.ToSt ring)
Return ""
End Try
End Function
End Class