ByteScout Premium Suite - VB.NET - Batch read barcodes to csv with barcode reader sdk - ByteScout

ByteScout Premium Suite – VB.NET – Batch read barcodes to csv with barcode reader sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – VB.NET – Batch read barcodes to csv with barcode reader sdk

How to batch read barcodes to csv with barcode reader sdk in VB.NET with ByteScout Premium Suite

Learn to code in VB.NET to batch read barcodes to csv with barcode reader sdk with this step-by-step tutorial

These source code samples are assembled by their programming language and functions they apply. ByteScout Premium Suite can batch read barcodes to csv with barcode reader sdk. It can be applied from VB.NET. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.

Want to save time? You will save a lot of time on writing and testing code as you may just take the VB.NET code from ByteScout Premium Suite for batch read barcodes to csv with barcode reader sdk below and use it in your application. Follow the instructions from scratch to work and copy the VB.NET code. Further improvement of the code will make it more robust.

Trial version of ByteScout Premium Suite is available for free. Source code samples are included to help you with your VB.NET app.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.vb
      
Imports Bytescout.BarCodeReader Module Program Sub Main() Try 'Read Barcode Process Dim reader As Reader = New Reader reader.RegistrationKey = "demo" reader.RegistrationName = "demo" ' Set Barcode type to find reader.BarcodeTypesToFind.SetAll() ' Output list Dim lstCSVOutput As New List(Of CSVOutputFormat) ' Get all files in folder, and iterate through each file Dim files = System.IO.Directory.GetFiles("BarcodeFiles") For Each fileName As String In files ' ----------------------------------------------------------------------- ' NOTE: We can read barcodes from specific page to increase performance . ' For sample please refer to "Decoding barcodes from PDF by pages" program. ' ----------------------------------------------------------------------- ' Read barcodes Dim FoundBarcodes As FoundBarcode() = reader.ReadFrom(fileName) For Each code As FoundBarcode In FoundBarcodes lstCSVOutput.Add( New CSVOutputFormat With { .barcodeType = code.Type.ToString(), .barcodeValue = code.Value, .scanDateTime = DateTime.Now.ToString(), .fileName = fileName }) Next Next Console.WriteLine("Total {0} barcode found in {1} file.", lstCSVOutput.Count, files.Length) ' Export to CSV ExportToCsv(lstCSVOutput) ' Cleanup reader.Dispose() Catch ex As Exception Console.WriteLine(ex.Message) End Try Console.WriteLine("Press enter key to exit...") Console.ReadLine() End Sub Sub ExportToCsv(ByVal lstCSVOutput As List(Of CSVOutputFormat)) Dim csvOutputContent As New System.Text.StringBuilder(String.Empty) csvOutputContent.Append("Barcode Value,Barcode Type,Scan DateTime,File Name") For Each item As CSVOutputFormat In lstCSVOutput csvOutputContent.AppendFormat("{0}{1},{2},{3},{4}", Environment.NewLine, item.barcodeValue, item.barcodeType, item.scanDateTime, item.fileName ) Next System.IO.File.WriteAllText("output.csv", csvOutputContent.ToString()) Process.Start("output.csv") End Sub Class CSVOutputFormat Public Property barcodeValue As String Public Property barcodeType As String Public Property scanDateTime As String Public Property fileName As String End Class End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next