Adding a Reference

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

I need to add a reference to System.Net, System.IO, and
System.Text.RegularExpressions but when I goto Project --> Add Reference I
cannot find these. I see many other System namespaces but not the ones I
need. How can I get these??

Thanks,
Joseph
 
By default, you already have a reference to the assemblies that contain the
namespaces you mention.

You don't make references to a namespace, only to the assembly that contains
the namespace.

If you don't want to have to type out the full namespace name (System.Text,
System.IO, System.Net), you can make an Imports statement (VB .NET) or a
Using statement (C#).
 
Scott, thanks for your response. Just to confirm - If my module needs to use
System.Text, for instance, and I have a reference to the System assembly in
my project, then I would use the Imports statement for VB.Net to access the
System.Text namespace for the module?

Thanks Again,
Joseph
 
Scott. Thanks. It's working now.

Joseph


Scott M. said:
By default, you already have a reference to the assemblies that contain the
namespaces you mention.

You don't make references to a namespace, only to the assembly that contains
the namespace.

If you don't want to have to type out the full namespace name (System.Text,
System.IO, System.Net), you can make an Imports statement (VB .NET) or a
Using statement (C#).
 
The Imports statement acts as a shortcut. Let's take the StringBuilder class
as an example. The StringBuilder class is located in the System.Text
namespace. If you do import the System.Text namespace your declaration would
look something like this: Dim sb As StringBuilder. If you did not import the
namespace the declaration would look like this: Dim sb As
System.Text.StringBuilder.

More info on Imports -
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmImports.asp
Namespaces -
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconNamespaces.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmnamespace.asp
 
Back
Top