title: How to get local ip address using vb?
body: <p>How to get ip address in vb.net. i used below code to get local ip address but it showing  dns is not declared. can any one tell me what is that Dns in the Code</p>
  
  <p><strong>VB Code</strong></p>
  
  <pre><code>Imports System.Environment
  Imports System.Net
  
  Public Class Tester
  Public Shared Sub Main
  Dim hostname As String = Dns.GetHostName()
  Dim ipaddress As String = CType(Dns.GetHostByName(hostname).AddressList.GetValue(0), IPAddr
  ess).ToString
  Console.WriteLine("Computer Name: " &amp; hostname &amp; " IP Address: " &amp; ipaddress)
  End Sub
  
  End Class
  </code></pre>