Barcode Fonts, Components, ActiveX and .NET Windows Forms Controls, Java Servlets, 
DLLs and Barcode Scanners., Inc., Computers Hardware, Software & Services, Tampa, FLThis site chose the Norton Secured Seal to promote trust online with consumers. View your cart in the IDAutomation Store

Home > Barcode Components > ActiveX Control > FoxPro Barcode FAQ & Tutorial:

FoxPro Barcode FAQ & Tutorial

In this FoxPro Barcode FAQ and tutorial, IDAutomation outlines integrating the Barcode ActiveX Control into Microsoft Visual FoxPro 6 forms and reports.

Integrating the ActiveX Control

  1. To use the ActiveX Control on a form, switch to 'Design Time', select the "ActiveX Control (OleControl)" on the Form Control toolbar and click on the form. After the "Insert Object" dialog box opens, select "Insert Control" option. In the list of all installed ActiveX controls, select a control to use that begins with "IDAutomation".
    Insert Linear Bar Code ActiveX control to form
  2. The characteristics can then be modified in the properties window.
  3. To print barcodes on reports or labels, the Barcode ActiveX control should be embedded and prepared in the table field of type General, and then displayed in the report. This will require some programming of code for preparing the Barcode ActiveX control in General field.
  4. Assuming there is a data table already created, add to the table the field of type General called "CodeGen".
    Adding a field of General type to the Items table
  5. To display it in a report, put the Picture/ActiveX Bound Control, then select the "File" option and specify General Field and name in it ("Items.CodeGen").
    Specify properties for ActiveX control printing
  6. Then, prepare the code that will populate the General Field by the Barcode ActiveX control with appropriate data from the Code Field for each record in the Items table. This code should run before printing. This can be organized by one of the following ways:
    1. Define code in the custom program that calls a report, such as in the VFP barcode example.
    2. Define code in the BeforeOpenTables event of the data environment in the report: right-click on the report in report designer window, select "Data Environment" menu item, double click on data environment window and write the code there, for example in the picture below.

    Define code for preparing the Bar Code ActiveX in General field

  7. The code might be a bit complex and require use of a custom form. The code displayed in above picture may be acquired here or download the VFP barcode example for an implementation created in VFP 6.0, which demonstrates how to store the BarCode ActiveX in the field of General type, display it on a form and print. The sample also includes a simple code to demonstrate how to prepare appearance and properties for the ActiveX control embedded in General Field before printing.

Resolving Version Issues with ActiveX

If a different version of the Barcode ActiveX Control is installed, errors may appear in the existing Visual FoxPro application making use of the ActiveX Control. One of the following suggestions below may resolve this issue:

If the form with the Barcode ActiveX on it does not open after installing a new version of the ActiveX control:

The best way to fix this problem is to install a previous version of ActiveX control again. Then open the VFP form and remember or write down all property settings for BarCode ActiveX control (right-click on properties window and select the "Non-Default Properties Only" option that will list all properties for which values should be remembered). Remove the ActiveX control from the form and save the configuration. Close the VFP development environment. Install the new version of the ActiveX control. Open the form, put the ActiveX control on the form again and specify property values in exactly the same way. Naturally, this will require recompiling of the VFP application.

The form code may also be modified to enable the ActiveX control in code during run time, as in the VFP barcode example. If the ActiveX control is created and property values assigned at run-time, different versions of ActiveX on the form will work with the same code.

If the Barcode ActiveX stored in fields of General type causes an error when trying to use it:

After installing a different ActiveX control version, another program should create a new ActiveX control in general field and set property values accordingly. This will not require recompiling the application - only the data needs to be updated.

In the VFP barcode example, there will be a sample of the report printed using a dynamically prepared ActiveX control in General fields with sample of setting properties for it. It is recommended to use this approach so a different version of the control will not cause problems.

Special thanks to Vlad Grynchyshyn for providing information on using the Barcode ActiveX Control in FoxPro.

 ©Copyright 2017, All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us

Training Videos on YouTube  Join us on Google Plus  Join us on LinkedIn  Follow us on Twitter  Like us on Facebook
Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.