Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Classes 1

Status
Not open for further replies.

joxo1

Programmer
Aug 5, 2004
25
0
0
GB
Hi,

I have created a class module which contains various useful functions.

Some of the functions use recordsets.

If I am using the class in a project that doesn't use databases (and therfore dosn't reference ADO), I get an error in the class at run time of "User defined type not defined" because of the functions that use recordsets.

Is there anyway that the class can "Ignore" those functions without me having to comment out the relevent code?

Do I have to remove those functions (don't want to!)?

Cheers in advance..

 
joxo,

you could always just add the ADO references to your project, this shouldn't add anything to your compile time or affect memory usage in any noticable way...it would just be an unused reference.

- "The truth hurts, maybe not as much as jumping on a bicycle with no seat, but it hurts.
 
That's a very good idea! One that will certainly work and one I hadn't thought of!

.....BUT,


I would really like to keep the class self contained and not rely on methods external to the class.

Is there any way of doing that? Can I keep the whole solution within the class itself?


Cheers
Jan
 
If you want to keep it as a class, don't think so.
But you could compile it as an ActivX DLL. This DLL will be available only for VB projects and will have to be registered on client's machines but it will be self contained. For a new project using it you will have to refference it in your project.
Frankly, I don't thisk this is a good solution, but if you want it self contained...

Hope I've been helpful,
Bogdan Muresan.
 
If you don't want your users to have to make references to libraries they don't need, then you'll have to split up your functionality into separate classes (or DLLs, depending on how you plan to package/distribute).

kmfna's idea is pretty good. Only catch might be if you were to distribute to someone who didn't have ADO/MDAC installed (for example), in which case I don't believe the project will load (unresolved references).

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top