- Create a new project
- Add a TextBox and name it “txtHostname”
- Add another TextBox and name it “txtIP”
- Add a button and name it “btnResolve” and give it appropriate text like “Resolve IP”
- Double click on the button to auto generate the button action code and insert code as shown below
Imports System.Net Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResolve.Click Dim hostname As IPHostEntry = Dns.GetHostByName(txtHostname.Text) Dim ip As IPAddress() = hostname.AddressList txtIP.Text = ip(0).ToString() End Sub End Class
Last Updated on October 26, 2015