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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help! Manually adding ADO components

Status
Not open for further replies.

JediDan

Programmer
May 15, 2002
128
US
Hello!

I have a database program in which I've placed ADO Connections,Commands, etc. from the ADO toolbar. These work fine.

I would like to remove this from the form and manually add them in the code. Is this possible?

Any help is appreciated.

Thanks.
 
Yes this is possible, but why do you want to do this? If the components are to be available whenever the form is you are as well leaving them on the form as they are easier to maintain (IMHO)

Anyway should you want to do that it is a matter of declaring the componentunder private (or wherever)
YourName: ComponentType;

Then in your code: (ie form create)
YourName := ComponentType.Create(Self);

And when done with it:
Yourname.Free; Robertio
Alias: Robbie Calder
Software Developer
urc@walkermartyn.co.uk
 
Thanks for your help, it's working great now.

I guess I don't like the idea of setting up a component visually when it's not something to be seen by the user.

Is there a way to put these kind of declarations in something like a VB Module, so they're not explicitly part of one particular form/unit?

Thanks.
 
There is a special form called DataModule where you can put all non visual components, yet they are available for other forms and components. This datamodule will not accept any visual components like tedits, dbgrids etc.

Candidates to be placed in a datamodule are:
database, query, table, actionlist, imagelist, storedproc, adoconnection, datasource etc.

Regards Steven van Els
SAvanEls@cq-link.sr
 
yeah, data modules are great for getting the non-visible components off the form. Depending on the project I will usually use a datamodule to hold my queries and whatnot, but on large projects, I have a tendency to leave them on the form that they are a part of, unless they are used by multiple forms.
 
Thanks folks, really appreciate the help.

-Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top