bardecode.com
barcode reading software
  • Home
  • Download
  • Purchase
  • SDK Licensing
  • Pricing
    • Windows SDK Price List
    • Windows SDK with PDF Extension Price List
    • Linux SDK Price List
    • Linux SDK with PDF Extension Price List
    • PDF Extension For Windows Price List
    • Multi-Platform Toolkit for .NET Price List
    • BardecodeFiler Desktop Only Price List
    • BardecodeFiler Windows Service Price List
    • DOS Command Prompt Barcode Tool Price List
    • Terms and Conditions
    • Refund Policy
  • Products
    • Softek Barcode Reader Toolkit for Windows
    • Softek Barcode Reader Toolkit for Linux
    • BardecodeFiler Desktop App
    • BardecodeFiler Windows Service
    • Windows DOS Command Prompt Tool
    • Multi-platform barcode reader toolkit for .NET
    • Aquaforest’s Autobahn DX
  • Knowledge Base
    • Documentation
    • Specifications
  • News
  • Contact
    • About Us
    • Terms and Conditions
    • Resellers
    • Links
Select Page ...

News

Code snippets for VB.net

admin November 23, 2012 Knowledge Base, Software Development Kits No Comments

This arcticle shows some simple VB.net code snippets that reference the .net component or com object for the SDK in Visual Studio.

.NET Managed Class Library with Visual Studio 2003

‘Add a reference to SoftekBarcodeLib.dll

Dim barcode As SoftekBarcodeLib.BarcodeReader
barcode = New SoftekBarcodeLib.BarcodeReader

‘Set properties
barcode.ReadCode128 = True

‘Read barcodes
nBarCodes = barcode.ScanBarCode(Path)

‘Get results
For i = 1 To nBarCodes
strBarcode = barcode.GetBarString(i)

.NET Managed Class Library with Visual Studio 2005/2008

‘Add a reference to SoftekBarcodeLib2.dll

Dim barcode As SoftekBarcodeLib2.BarcodeReader
barcode = New SoftekBarcodeLib2.BarcodeReader

‘Set properties
barcode.ReadCode128 = True

‘Read barcodes
nBarCodes = barcode.ScanBarCode(Path)

‘Get results
For i = 1 To nBarCodes
strBarcode = barcode.GetBarString(i)

Standard Windows DLL

Dim hBarcode As System.IntPtr

hBarcode = mtCreateBarcodeInstance()

‘See the example project for the function definitions for the SoftekBarcode dll file.

‘Set properties
mtSetReadCode128(hBarcode, True)

‘Read barcodes
nBarCodes = mtScanBarCode(hBarcode, Path)

‘Get results
For i = 1 to nBarCodes
strBarcode = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(mtGetBarString(hBarcode, i)))

mtDestroyBarcodeInstance(hBarcode)

COM Object

‘Add a reference to SoftekATL.dll
Dim oBarcode As SoftekATL.CBarcode
oBarcode = New SoftekATL.CBarcode

‘Set properties
oBarcode.ReadCode128 = True

‘Read barcodes
oBarcode.ScanBarCode(Path.ToString)
nBarCodes = oBarcode.BarCodeCount

‘Get results
For i = 1 to nBarCodes
strBarcode = oBarcode.BarString(i)

Adding References to Visual Studio

To add a reference in Visual Studio, select “Add Reference” from the Project menu.

To add a reference for the managed class library, browse for the SoftekBarcodeLib.dll file for VS 2003 and SoftekBarcodeLib2.dll for VS 2005/2008 in your windows system folder.

To add a reference for the COM object, click on the COM tab and select SofteATL 1.0 Type Library from the list.

← Splitting TIF files by barcode position
Code snippets for Visual C++ →
admin

  • Copyright © 2023 Softek Software Ltd. All Rights Reserved