Reference Question

MTSkull

Centurion
Joined
Mar 25, 2003
Messages
151
Location
Boulder, Colorado
I am having a bit of a problem and I do not know if it is my inexperiance with .net or something else.

I have a project reference to system.data

if I type in a form in the project

"Dim dsProducts As New DataSet"

I get an error that it can not find DATASET but if I type...

"Dim dsProducts As New System.Data.DataSet"

It is happy with this. How do I expose the refernces so I do not have to type the full reference name like several examples I have. This is true for all references no matter what they point to. (ie messagebox())

Thanks
Brian:confused:
 
At the top of your source file you should see something like
using System; (using is C# syntax not VB)
Just put
using System.Data;
with the rest of them. Except VB syntax instead.
 
Thanks...

So just to clarify. Even if I set a refrence in the solution explorer that means mothing to the rest of the project, I still have to put "Imports System.Data" at the head of every code module? If this is true why did they bother with the refrencing in the Solution Explorer... Stupid Microsoft:mad:

Thanks Again
Brian
 
If you didnt reference in the solution explorer you wont be able to use the Data namespace at all, because there you add the actual file that contains the namespace to your project. In
Visual Basic:
imports System.Data
You only make a shortcut to the classes in the namespace.
 
If everything was chucked into one list without the Imports statement, you would spend AGES searching through every class of the 1000+ of the .Net Framework whilst looking for a particular function when you could just System.Data and know eveything there has something to do with databases.

References are like in VB6 and C++, etc. You must #Include "MyHeader.h" or Project>References to add a connection to a DLL
 
...Stupid Microsoft

MTSkull,

Making a reference to an external assembly and creating a shortcut so you don't have to fully-qualify class names are two very different things.
 
This is simply a case of my inexperience with .net. Like VB6 I had assumed that if something was reflected in the references that I could use it anywhere. With Andres explanation as to the why's I see the logic behind this mechanism.

You can never convince me that MS is not stupid in some ways. For every piece of brilliance they produce there is a corresponding thing that makes you scratch your head and go "What the heck where they thinking" and I can cite numerous examples. I do not hate MS and I suppose there is a reason behind everything they do. After all Bill did something right, he is the one with all the cash. :rolleyes:

Brian

PS one thing I really LIKE about .net is having this site open on one of the programming tabs :)
 
Back
Top