Link Search Menu Expand Document

Visual Basic 6 (saving to PNG images)

The following example demonstrates how to use BarCode SDK as ActiveX object in Visual Basic 6 (Barcode class object) to generate barcodes and save as PNG images

VISUAL BASIC 6 AND CLASSIC ASP SPECIAL NOTES: To use enumerations in VB6 or classic ASP you should use their integer values instead. To get integer value just check the documentation and you will see the integer value in the brackets. For example: (1) Code39.

VB
Private Sub Form_Load()

 ' IMPORTANT NOTE: you need to have .NET Framework 1.10 installed to use BarCode SDK from Visual Basic
 ' to download and install .NET Framework 1.10 please use this link: http://www.microsoft.com/downloads/details.aspx?familyid=262D25E3-F589-4842-8157-034D1E7CF3A3

 Set bc = CreateObject("Bytescout.BarCode.Barcode")

 ' display information about Code39 symbology
 MsgBox "Encoding '012345' using Code39 symbology" & vbCrLf & bc.GetValueRestrictions(0)  ' 0 = Code39 symbology

 ' set symbology type
 bc.Symbology = 1 ' 1 = Code39

 ' set value to encode
 bc.Value = "012345"

 MsgBox "Saving Code39 barcode to 'Code39.png'"

 bc.SaveImage "Code39.png" ' change to "c:\Code39.png" if you can not locate the file. The default directory is the folder where Project1.exe is located

 MsgBox "Encoding '012345' using Aztec symbology"

 ' set symbology type
 bc.Symbology = 17 ' 17 = Aztec
' set value to encode
 bc.Value = "012345"

 ' display information about Aztec symbology
 MsgBox "Encoding '012345' using Aztec  symbology" & vbCrLf & bc.GetValueRestrictions(17) ' 17 = Code39 symbology

 bc.SaveImage "Aztec.png" ' change to "c:\Aztec.png" if you can not locate the file. The default directory is the folder where Project1.exe is located

 Set bc = Nothing

End Sub