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

C# & VB.NET: Code 39 Scanning

back to home  >  .NET Barcode Reader SDK  >  Recognize Barcodes in .NET  >  Code 39 Barcode Scanning Using C# and VB.NET

From Barcode Scanner Component for .NET page, you will know that this mature component supports more than 10 bar code symbols, like linear barcodes Code 39, Code 128, UPC/EAN and two-dimensional barcodes QR Code, PDF-417. To help C# and VB.NET users better use our software, we depicts C# online tutorial and VB.NET online tutorial for barcode scanning. And here, we focus on Code 39 1D barcode scanning in Visual C# and VB.NET programming.

On this tutorial, you will get free C# and VB.NET class codes for Code 39 decoding and recognizing in .NET application. If you are using the free trial package of our .NET component for barcode reading, the first character of Code 39 barcode will be randomly decoded. And the last character might be the check digit of Code 39 if it has one. Note: as for Code 39 linear barcode, a Modulo 43 checksum digit is optional for additional security.

Free C# and VB.NET Class Codes

This section includes two parts. One is C# class code for Code 39 reading from image and the other is VB.NET class code for Code 39 reading from image. And we take local image file as image source in the two examples. Certainly, you are able to load an image source in bitmap or stream form. Furthermore, the way of bar code recognition in C# & VB.NET is user-defined, including scanning a target barcode symbol and scanning all barcode types from loaded image file. Please note, reading the color barcode is also supported.

C# Class Code: Read Code 39 1D Barcode

From the following Visual C# class coding examples, we tell how to detect and read Code 39 linear barcode from a local image file. And Code 39 is the target barcode type. More APIs can also be found in the following demo codes.

public void ScanCode39FromFile(string filename)
  // Code 39 detecting and reading from a local image file in C#.NET class.
  BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.Code39);

  // Code 39 detecting and reading from a Bitmap or Stream of image in C#.NET class.
  // 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);
// Used to improve barcode scanner accuracy when there's only one Code 39 on image.
Bitmap bmp = new Bitmap("YourImagePath");
BarcodeResult barcode = BarCodeScanner.ScanSingle(bmp);
Console.WriteLine("barcode data:{0}.", barcode.Data);

VB.NET Class Code: Read Code 39 1D Barcode

Similarly, the first Visual Basic class coding example tells how to detect and recognize all barcode types from an image file on your local disk. Besides Code 39, other barcode symbols on the image will be decoded and output. VB.NET APIs for barcodes decoding from bitmap and stream of image are also provided in this demo code. Moreover, you can learn how to improve barcode reading accuracy when your image source only includes one Code 39 barcode.

Public Sub ScanAllFromFile(ByVal filename As String)
  ' Detect and recognize all barcode types from a local image file in VB.NET class.
  Dim results() As BarcodeResult = BarCodeScanner.Scan(filename)

  ' Detect and decode all barcode types from Bitmap or Stream of image in VB.NET class.
  ' 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
' Used to improve barcode scanner accuracy when there's only one Code 39 on image.
Dim bmp As Bitmap = New Bitmap("YourImagePath") 
Dim barcode As BarcodeResult = BarCodeScanner.ScanSingle(bmp) 
Console.WriteLine("barcode data:{0}.", barcode.Data)
pqScan SDK
.NET Barcode Scanner DLL
Online Guide
How to Scan Barcode for .NET How to Scan Barcode Using C# How to Scan Barcode Using VB
Barcode Type
C#/VB QR Code Scanning Demo C#/VB PDF-417 Scanning Demo C#/VB Data Matrix Scanning Demo C#/VB Aztec Code Scanning Demo C#/VB Code 128 Scanning Demo C#/VB EAN-13 Scanning Demo C#/VB EAN-8 Scanning Demo C#/VB UPC-A Scanning Demo C#/VB UPC-E Scanning Demo C#/VB Code 93 Scanning Demo C#/VB Codabar Scanning Demo C#/VB ITF-14 Scanning Demo View All Barcodes >>
I like this barcode reader. I have always wanted to find a solution to read rotated Code 39 from image file. Till now, only this SDK works well. Now, I decide to make an order for it. Lee Finkelman