The annotated part-progam listing below illustrates the creation of a Code 39 barcode for the code 123456 using OLE automation from the Visual Basic (version 5) container. The program assumes that a form containing and Image (Image1) has been created for display of the barcode.
Set a =
CreateObject("dBarcode-1D.Image")
'start dBarcode
a.dBarInit
'initialise variables
a.icode =
8
'set code 39
a.ishowtext =
1
'set text on
a.lforecolor =
0
'bar colour black
a.lbackcolor =
&HFFFFFF
'background white
a.ifontheight =
10
'font 10 point
a.sfontname =
"Arial"
'font Arial
a.ilength =
3500
'length 35 mm
a.iheight =
2500
'height 25 mm
a.scode =
"123456"
'code
123456
a.dBarCopy
'make image
i =
a.ierror
'retrieve error code
if (i>0) then Print
"Error";i
'check if non-zero
Image1.Picture =
Clipboard.GetData(3) copy picture to
Image1