Adding a Reference vs Adding a Control 
Author Message
 Adding a Reference vs Adding a Control

I am developing a project in VB6.  This project involves using ADO to
connect to an external ODBC data source.  I do not use the ADODC
control within my program but wish to use its functionality.  I have
recently read where I can go to the project's references and add a
reference to MSADO without adding a control to any of my forms.

I usually place an ADODC control on my main form.  I then do something
similar to the following in a module.bas file:

Public MyConnection as ADODB.Connection
Public MyRecordset(1 to 10) as ADODB.Recordset

Does it matter which method is used?  Is there any
performance/development issues that I should be aware of?

Thanks for any input.

Tue, 08 Feb 2005 20:09:14 GMT  
 Adding a Reference vs Adding a Control
In Visual Basic 6 when you add ADO DataControl in component ADO is not
added to the reference
But when you place an ADO Data Control on the form Microsoft ADO 2.X is
automatically added to the reference.

You dont have to add the control to get the ADO 2.X reference. You can add
the reference without adding any controls and you will be able to use all
the ADODB objects like ADODB.Connection, ADODB.Recordset. etc.,

Its always a good idea not to load any controls when you dont need them.

Hope this answers your question.

Ramesh Thyagarajan, MCSD,MCDBA
Microsoft Developer support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit

Tue, 08 Feb 2005 21:27:04 GMT  
 [ 2 post ] 

 Relevant Pages 

1. referencing dll vs adding a class

2. NEWBIE: Masked Edit Control - How do I add it to my project references

3. Adding control references on the fly?

4. How to add existing control to picturebox using its reference

5. Use Curland's add-in to set WithEvents reference to OCX in control-array

6. Can not add reference to MS CE ADO control

7. Adding a Custom Control to the VS.NET Toolbox

8. VB5 vs VB4 speed of Add method for Treeview control

9. Adding a control to a windows form from an add-in

10. VB6 : Adding usercontrols using Controls.Add

11. How to add code to form and controls from my Add-In

12. ? Collection add object -> usercontrol add control


Powered by phpBB® Forum Software