Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


[VB.NET]DNS IP Lookup filter_list
Author
Message
[VB.NET]DNS IP Lookup #1
Well, for this tutorial you should add 2 Labels, 2 TextBox Controls and 1 Button. Make your form look something like this:
[Image: cLK6eR3.png]


Go in to the code view, and paste this function which will retrieve the ip of the website.

Code:
Public Function GetIP(ByVal URL As String)
        If url.ToString.Contains("http://") Then
            url = url.Replace("http://", String.Empty)
        End If
        If url.ToString.Contains("/") Then
            url = url.Replace("/", String.Empty)
        End If

            Dim hostname As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(URL)
            Dim ip As System.Net.IPAddress() = hostname.AddressList
            Return ip(0).ToString()
    End Function

Then, go back to design view and double click your button and paste the code below which will place the IP in TextBox2
Code:
TextBox2.Text = GetIP(TextBox1.Text)

If this works, you should see something like this:
[Image: mFiOsAd.png]
[Image: GiXvY27.png]

Reply

RE: [VB.NET]DNS IP Lookup #2
Could be useful for future projects of mine, thanks Smile.

You can also use "" instead of string.empty like so:
url = url.Replace("http://", "")
[Image: tumblr_m4vms28lYu1qj3ir1.gif]

Reply







Users browsing this thread: 1 Guest(s)