Code 128 Image Sample - pqScan.com
.NET Barcode Reader SDK Building up Perfect Quality Barcode Reading Software for .NET Online Demo Download Trial Purchase Now
.NET
C# & VB.NET

C# &VB.NET: Scan Code 128 on Image

back to home  >  .NET Barcode Reader SDK  >  Recognize Barcodes in .NET  >  C# and VB.NET Tutorial for Code 128 Reading

pqScan Barcode Reader SDK for .NET is a strong-named component DLL which can be used for C# and VB.NET barcode recognition. It supports commonly used linear and two-dimensional bar code symbols. On this tutorial page, we will give you C# coding example for Code 128 reading, as well as VB.NET coding example for Code 128 font reading. Now, you may directly download free trial package of our Barcode Decoder Component for .NET online to have a quick test.

At the very beginning, one thing you should know. The free .NET Barcode Reader SDK package is used for testing purpose only and the first decoded Code 128 data will be a random character. Except this, there are no other differences between free trial SDK and production SDK.

Code 128 Reading Examples

If you are a Visual C# or VB.NET programmer, this part will help you a lot. After adding reference to our .NET barcode scanner component in Visual Studio project, you can easily use robust APIs to implement fast Code 128 barcode detecting and scanning.

In details, you are able to load image file (Jpeg/Jpg, Tiff/Tif, Png, Bmp or Gif) in the forms of bitmap, local picture at pc and stream to your Visual Studio C# or VB.NET application. If the Code 128 1d bar code on loaded image source is rotated to 180 degree, it still can be recognized by our barcode reader DLL library for .NET. The following two examples illustrate how to use C# and VB.NET class codes to scan and read Code 128 barcode from an image file on your local disk.

C# Example: Detect and Read Code 128 on Image

public void ScanCode128FromFile(string filename)
{
  // Set Code 128 as target barcode type and read from loaded image file.
  BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.Code128);

  // Set Code 128 as target barcode type and read 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);
  }
}

VB Example: Detect and Read All Barcodes on Image

Public Sub ScanAllFromFile(ByVal filename As String)
  ' Read all barcode symbols from loaded image file.
  Dim results() As BarcodeResult = BarCodeScanner.Scan(filename)

  ' Read all barcode symbols from images in Bitmap and Stream forms.
  ' 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)
  Next
End Sub

To see related barcode detecting and reading tutorials, please go to .NET Barcode Reading Tutorial - Overview page. Besides .NET solution for C# & VB.NET Code 128 reading, we also provide .NET solution for C# & VB.NET Code 128 generation. Please click to see details.

pqScan SDK
.NET Barcode Reader Control
Online Guide
Barcode Recognition in .NET Barcode Recognition in C# Barcode Recognition in VB.NET
Barcode Type
QR Code Recognition in C#/VB PDF-417 Recognition in C#/VB Data Matrix Recognition in C#/VB Aztec Code Recognition in C#/VB Code 39 Recognition in C#/VB EAN-13 Recognition in C#/VB EAN-8 Recognition in C#/VB UPC-A Recognition in C#/VB UPC-E Recognition in C#/VB Code 93 Recognition in C#/VB Codabar Recognition in C#/VB ITF-14 Recognition in C#/VB View All Barcodes >>
Having not been using pqScan SDK for very long. But so far, it has all supportive functions that I need. I think it is great software that should be recommended. I love it! Eli Davis