Hi

I wonder if anyone can help?

I am new to Visual Web Developer and .NET I am trying to get the pc name from its IP, I have code to get ip from pc name :

Protected Sub DNSLookup(ByVal IPAddress As String)

        Try

            'performs the DNS lookup
            Dim returnvalue = ""
            Dim he As IPHostEntry = Dns.GetHostEntry(IPAddress)
            Dim ip_addrs As IPAddress() = he.AddressList

            txtIPs.Text = ""
            For Each ip As IPAddress In ip_addrs
                txtIPs.Text = ip.ToString()

            Next ip
        Catch ex As System.Exception

            lblStatus.Text = ex.ToString()
        End Try



    End Sub

But I want it the other way around, can anyone help please?

Are you trying to get the PC Name or the DNS Hostname of an IP Address? They are two different things and you will only be able to sometimes get the pc name if they are on your LAN. If you are trying to get the DNS name of the IP and your code is not working please post the error message.

Also -- Use code tags in the future when you post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.