Code 128 Image Sample -
.NET Barcode Reader SDK Building up Perfect Quality Barcode Reading Software for .NET Online Demo Download Trial Purchase Now

Read Codabar Using C# & VB.NET

back to home  >  .NET Barcode Reader SDK  >  Recognize Barcodes in .NET  >  Codabar Recognition Using C# & VB.NET offers a solution, called .NET Barcode Reader SDK, for Codabar barcode recognition in Visual Studio .NET windows and web applications. C# and VB.NET programming languages are compatible with this complete software. As long as your computer install .NET Framework 2.0 (or above) and Visual Studio 2005 (or above), various advanced .NET Codabar bar code scanning functions can be used in C# and VB.NET programming.

By using mature APIs, you may choose to scan Codabar only from image file or scan all barcode types at a time. What's more, a rotated Codabar barcode symbol (180 degrees) can also be recognized from image. In the following two parts, Visual C# and VB.NET class codes are provided for free evaluation.

The online trial SDK can be used for testing purpose only. If you plan to use our .NET Barcode Scanner Component for commercial use, at least one developer license should be ordered. If you have any requests or questions, please send email to

Read Codabar Using C#

public void ScanCodabarFromFile(string filename)
  // C# class code for reading Codabar from image string. Only this barcode type will be decoded.
  BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.Codabar);

  // Choose to read Codabar and other barcode types from images in Bitmap and Stream forms.
  // public static BarcodeResult[] Scan(Bitmap bitmap, BarCodeType barType);
  // public static BarcodeResult[] Scan(Stream stream, BarCodeType barType);

  foreach (BarcodeResult result in results)
    Console.WriteLine(result.BarType.ToString() + "-" + result.Data);

We also provide the method to improve the accuracy of barcode scanning. If your image source has only one Codabar barcode, you can directly use the following C# sample code for more accurate barcode recognition.

Bitmap bmp = new Bitmap("YourImagePath");
BarcodeResult barcode = BarCodeScanner.ScanSingle(bmp);
Console.WriteLine("barcode data:{0}.", barcode.Data);

In the above code, three APIs are provided which enable C# programmers to read and decode Codabar from image file in string, stream and bitmap values. As you see, Codabar is the only barcode type that will be decoded by our Barcode Reader DLL for .NET. More related barcode recognition tutorials can be found here: Online Barcode Recognition Tutorial for .NET.

Read Codabar Using VB.NET

Public Sub ScanAllFromFile(ByVal filename As String)
  ' All barcode types on image file will be decoded.
  Dim results() As BarcodeResult = BarCodeScanner.Scan(filename)

  ' All barcode types on images in Bitmap and Stream values will be decoded.
  ' public static BarcodeResult[] Scan(Bitmap bitmap)
  ' public static BarcodeResult[] Scan(Stream stream)

  Dim result As BarcodeResult
  For Each result In results
    Console.WriteLine(result.BarType.ToString() + "-" + result.Data)
End Sub

The following VB.NET example illustrates how to improve barcode scanning accuracy when there's only one Codabar on your image source.

Dim bmp As Bitmap = New Bitmap("YourImagePath") 
Dim barcode As BarcodeResult = BarCodeScanner.ScanSingle(bmp) 
Console.WriteLine("barcode data:{0}.", barcode.Data)

This free VB.NET class code tells how to recognize all barcode types from loaded image source. If you only need to recognize Codabar barcode, you may define it as the target barcode type, like setting in Visual C# demo above.

pqScan SDK
.NET Barcode Decoder Library
Online Guide
.NET Barcode Decoding Tutorial C# Barcode Decoding Tutorial VB Barcode Decoding Tutorial
Barcode Type
C#/VB: How to Read QR Code C#/VB: How to Read PDF-417 C#/VB: How to Read Data Matrix C#/VB: How to Read Aztec Code C#/VB: How to Read Code 128 C#/VB: How to Read Code 39 C#/VB: How to Read EAN-13 C#/VB: How to Read EAN-8 C#/VB: How to Read UPC-A C#/VB: How to Read UPC-E C#/VB: How to Read Code 93 C#/VB: How to Read ITF-14 View All Barcodes >>
I have been using this library for one year. Everything works as promised. It is really a great, very stable and useful product. Sumner Banks