The coding instructions are formulated to help you to try-out the features without the requirement to write your own code. ByteScout Barcode Suite is the set that includes three different SDK products to generate barcodes, read barcodes and read and write spreadsheets: Barcode SDK, Barcode Reader SDK and Spreadsheet SDK. It can be applied to batch read barcodes to csv with barcode reader sdk using VB.NET.
The following code snippet for ByteScout Barcode Suite works best when you need to quickly batch read barcodes to csv with barcode reader sdk in your VB.NET application. This VB.NET sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Enjoy writing a code with ready-to-use sample VB.NET codes.
The trial version of ByteScout Barcode Suite can be downloaded for free from our website. It also includes source code samples for VB.NET and other programming languages.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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
60 Day Free Trial or Visit ByteScout Barcode Suite Home Page
Explore ByteScout Barcode Suite Documentation
Explore Samples
Sign Up for ByteScout Barcode Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Barcode Suite Home Page
Explore ByteScout Barcode Suite Documentation
Explore Samples
Sign Up for ByteScout Barcode Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: