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
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.