Guide
Binding VCL Controls to a TClientDataSet with LiveBindings in RAD Studio
Learn how to bind VCL controls to a TClientDataSet using LiveBindings in RAD Studio without writing manual data‑field code.
Published by Tasadduq Burney
05 Apr 2026, 12:41 UTC
4 min121K views0

Problem
You want VCL controls such as TEdit or TLabel to show and update data from a TClientDataSet without writing manual DataSource.DataField assignments or event handlers.
Takeaway
By adding a TBindSourceDB component and using the LiveBindings Designer you can create bidirectional links that keep the dataset and the controls in sync automatically.
Prerequisites
- RAD Studio 10.4 Sydney or later (the LiveBindings design‑time package is included).
- A VCL Forms Application project.
- A
TClientDataSetplaced on a form or aTDataModulewith some sample data loaded (e.g., viaLoadFromFileor created at runtime). - The VCL controls you wish to bind (e.g.,
TEdit,TLabel,TComboBox) already dropped on the form.
Procedure
-
Add the binding source
- Open the form in the Designer.
- From the Tool Palette, drag a
TBindSourceDBcomponent onto the form (or the DataModule). - With the component selected, set its
DataSetproperty to theTClientDataSetyou want to bind. - Optionally, set
AutoActivatetotrueso the source becomes active when the form is created.
-
Open the LiveBindings Designer
- Select the form, then choose View → LiveBindings Designer from the main menu (or press Alt+Shift+L).
- The designer splits into two panels: left shows available sources (your
TBindSourceDB), right shows bindable controls on the form.
-
Create the bindings
- In the left panel, expand the
TBindSourceDBnode to reveal its fields (e.g.,Field1,Field2). - Drag a field onto the target control you want to bind. For example, drag
Field1onto aTEdit. - A dialog appears asking for the binding mode. Choose
Editfor two‑way synchronization (control ↔ dataset) orDisplayfor read‑only. - Repeat for each control‑field pair you need.
- In the left panel, expand the
-
Activate the bindings
- In the LiveBindings Designer toolbar, click the Activate All Bindings button (green lightning bolt).
- Active bindings appear as green links; inactive or broken links are red.
-
Run and verify
- Press F9 to compile and run the application.
- Navigate the dataset (if you have a
TDBGridorTNavigator) and observe that the bound controls update instantly to show the current record’s values. - Edit the text in a bound
TEditand press Enter or move focus away; the change should be written back to theTClientDataSet. - To confirm the dataset receives the edit, place a breakpoint on the
TClientDataSet.OnAfterEditevent; it should fire after each control‑initiated change.
Expected Checks
- The LiveBindings Designer shows green links for every field‑control pair you created.
- Running the application yields immediate visual feedback: changing a record in the dataset updates the controls, and editing a control updates the dataset.
- No exceptions are raised when the form is created or when navigating the dataset.
Limitations
- LiveBindings require the RTL and FireMonkey packages; in a pure VCL project ensure the "LiveBindings" design‑time package is installed, otherwise the designer will be disabled.
- If you set the
TClientDataSet.Activeproperty tofalseat runtime (e.g., to reload data), the bindings become inactive. You must either setTBindSourceDB.Active := falsethentrueafter reactivating the dataset, or callBindings.Resetto re‑establish the links. - Complex expressions or custom converters are not covered by the basic drag‑and‑drop method; they require manual editing of the binding expressions in the LiveBindings Designer.
Recovery Options (Rollback)
If the bindings do not behave as expected:
- Select the
TBindSourceDBcomponent and set itsActiveproperty tofalse. - In the LiveBindings Designer, select each red link and press Delete to remove it.
- Delete the
TBindSourceDBcomponent from the form. - Re‑add a fresh
TBindSourceDBand repeat the binding steps. - As an alternative, revert to the classic VCL approach: set each control’s
DataSourceto aTDataSourcelinked to theTClientDataSetand set theDataFieldproperty directly.
Practical Verification
After completing the steps, you can verify the setup on a clean RAD Studio installation by:
- Exporting the project (File → Export → Export Project) to a zip file.
- Extracting it on another machine with the same RAD Studio version.
- Opening the project, compiling, and running it.
- Confirming that the LiveBindings Designer still shows green links and that the UI‑dataset synchronization works as described.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.