title: Declaration expected in VB dll
body: <p>First of all thanking everyone....</p>
  
  <p>I am currently working on VB. I am using Visual Studio 2008.</p>
  
  <p>The piece of code below is a console application which builds without any error.</p>
  
  <pre><code>    Imports System.Net
  
  
  Module Module1
  
      Public Sub Main()
  
          Dim address As IPAddress
          Dim remoteIP As System.Net.IPEndPoint
          Dim socketAddress As System.Net.SocketAddress
  
          Try
              address = IPAddress.Parse("192.168.0.187")
              remoteIP = New System.Net.IPEndPoint(address, 0)
  
              socketAddress = remoteIP.Serialize()
  
              Console.WriteLine("Address Family :" &amp; remoteIP.AddressFamily.ToString())
              Console.WriteLine("IP :" &amp; remoteIP.Address.ToString() &amp; "Port :" &amp; remoteIP.Port.ToString())
              Console.WriteLine("Socket address :" &amp; socketAddress.ToString())
  
  
          Catch ex As Exception
              Console.WriteLine(ex.StackTrace.ToString())
  
  
          End Try
  
      End Sub
  
  
  End Module
  </code></pre>
  
  <p>In the next program which is a dll the same gives error saying "Declaration Expected for addr, remoteIP and socketAddr"</p>
  
  <pre><code>Imports System.Net
  
  Public Class Class1
  
  
  End Class
  Public Class ethernet
  
      Dim addr As IPAddress
      Dim remoteIP As System.Net.IPEndPoint
      Dim socketAddr As System.Net.SocketAddress
  
      addr = IPAddress.Parse("192.168.0.187")
      remoteIP = New System.Net.IPEndPoint(addr,0)
  
      socketAddr = remoteIP.Serialize()
  
  
  
  End Class
  </code></pre>
  
  <p>Can anybody tell me why is this happening...</p>