Barcode Tools for Crystal Reports > Crystal Reports Designer for VB6

Step 4

Enter the code required to create the barcode from data in your chosen source field.

The code required here will frequently be very similar to that shown below, in fact if you have a field named Field5 on the report you can copy and paste this code directly into code window.

 

Private Sub scnDetail_Format(ByVal pFormattingInfo As Object)

Dim twips As Single

twips = 1.7639                  ' TWIPS scaling factor 2540# / (72# * 20#)

Set barcode1 = CreateObject("dBarcode.Control")  'start dBarcode

barcode1.Units = "mm"      

barcode1.CodeType = 9                'set code 128

barcode1.ShowText = 1                'set text on

barcode1.FontSize = 10                'font 10 point

barcode1.FontName = "Arial"      'font Arial

barcode1.ImageHeight = 15          'height 15 mm

barcode1.ImageWidth = 30           'length 30 mm

'a.Xunit = 12                                  'X = 12 Mils

barcode1.MarginSize = 4              'light margin 4 mm

barcode1.Data= Field5.Value          ' this is the barcode data source

Set Picture1.FormattedPicture = barcode1.Picture

Picture1.Height = barcode1.PictureHeight / twips

Picture1.Width = barcode1.PictureWidth / twips

End Sub

 

 

 

More:

Step 5