Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Posted

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.

C#
Posted

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

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

  • *Experts*
Posted

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

imports System.Data

You only make a shortcut to the classes in the namespace.

Posted

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

.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted

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 :)

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...