How to use the barcode components with a database

The LiveBindings is supported by the components package. You can use the LiveBindings mechanism to link a TBarcodeFmx2D barcode component to a data filed in order to encode the data in the database to barcode symbol.

  1. Put a TBarcodeFmx2D barcode component, such as the TBarcodeFmx2D_QRCode, TBarcodeFmx2D_PDF417, and TBarcodeFmx2D_RSS14 to your form. You can set its Image property to a TImage control in order to display the barcode symbol.

  2. Open the "LiveBindings Designer", click on the barcode component in the form to select it, change the "Visible Element" sub-item of the "LiveBindings Designer" item to true in the "Object Inspector", in order to display it in the "LiveBindings Designer".

  3. Right-click on the barcode component in the "LiveBindings Designer", execute the "Bindable Members..." menu item, check the "Barcode" property or the "Data" property in the "Bindable Members" dialog, click on the "OK" button to close it.

  4. If you want to encode values in a string field to barcode symbol, please link the Barcode property of the TBarcodeFmx2D barcode component to your data field in the TBindSourceDB component. If you want to encode values in a binary field to barcode symbol, please link the Data property of the TBarcodeFmx2D barcode component to your data field in the TBindSourceDB component.

  5. If you want to save the barcode symbol to a picture, put a TSaveFmx2D component, such as the TSaveFmx2D_Bmp, TSaveFmx2D_Png, and TSaveFmx2D_Svg to your form. Set the Barcode2D property of the TSaveFmx2D component to your barcode component. Then you can use the Save method of the TSaveFmx2D component to save the barcode symbol to a picture file.

  6. Also, you can use the Print method of the TBarcodeFmx2D component to print the barcode symbol to paper, or use the DrawTo method of the TBarcodeFmx2D component to draw the barcode symbol to any TCanvas.

Note, You can link multiple TBarcodeFmx2D components to a data field in order to represent the data field with multiple barcode symbols.

Contents