A sample program

The annotated part-program listing below illustrates the creation of a PDF 417 barcode for the code “DBARCODE 2D” using OLE automation from the Visual Basic (version 4) container. The program assumes that a form containing and Image (Image1) has been created for display of the barcode.

 

Set a = CreateObject("dBarcode2D.Image")          'start dBarcode
a.dBarInit                                   'initialise variables
a.code = 2                                  'set code to PDF 417
a.forecolor = 0                                      'bar colour black
a.backcolor = &HFFFFFF                         'background white
a.xunit = 50                                'bar width 0.5 mm
a.yunit = 500                              'bar height 5 mm
a.scode = "DBARCODE 2D"             'code DBARCODE 2D
a.dBarCopy                                 'make image
i = a.errorcode                                      'retrieve error code
if (i>0) then Print "Error";i              'check if non-zero
Image1.Picture = Clipboard.GetData(3)      copy picture to Image1