Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Imports statement in VB.Net

I get a compiler error whenever I try to use Imports System.Net or Imports
System.Windows.Forms in my code? I can use Imports System but not the above
two..any suggestions?

here's the error that I get

C:\DotNet\Step3.vb(2) : error BC30466: Namespace or type 'Net' for the Imports '
System.Net' cannot be found.

Imports System.Net

Tuesday, February 18, 2003

You also need to *reference* the DLL that contains the namespace. In your case you need to reference System.dll for the System.Net namespace and System.Windows.Forms.dll for the other.

Compiler switches:
vbc MyCode.vb /r:System.Net /r:System.Windows.Forms.dll ...

In VS.NET you right-click the Refernces folder and add it there.

Duncan Smart
Tuesday, February 18, 2003

Oops, that should have been:

vbc MyCode.vb /r:System.dll /r:System.Windows.Forms.dll ...

Duncan Smart
Tuesday, February 18, 2003

*  Recent Topics

*  Fog Creek Home