What is the purpose of having a DataModule in your project? Does it have any special properties compared to a normal class or module? What are the conventions of what it's usually used for?
Data modules are source objects that contain data from data servers, uploaded files, or other data modules, and are saved in My content or Team content. Data servers. Data servers are databases for which connections exist.
To add the data module to your project, right-click the project name in the Project Manager and then click Add New > Other... to display the New Items dialog. Select Data Module and click OK.
A data module is like a special form that contains nonvisual components. All the components in a data module could be placed on ordinary forms alongside visual controls.
A datamodule is a non-visual "form" (container) that can contain non-visual components (usually database components, though any component can be added, such as dialogs and Indy components) that can then be shared by many forms.
This wiki explains further: Delphi Wikki.
It is normally used for Dataset and DataSource objects to keep them in a central location. A DataModule can only contain nonvisual components on it but are not just limited to Data Access components. You could put a TTimer on it and SaveDialog etc...
It can be useful when you have multiple forms, needing to change the code only in one place, instead of every form.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With