This page explains the steps and algorithm of implementing gui example for barcode reading with barcode reader sdk and how to make it work in your application. Gui example for barcode reading with barcode reader sdk in VB.NET can be applied with ByteScout Premium Suite. ByteScout Premium Suite is the set that includes 12 SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
If you want to quickly learn then these fast application programming interfaces of ByteScout Premium Suite for VB.NET plus the guideline and the VB.NET code below will help you quickly learn gui example for barcode reading with barcode reader sdk. Follow the steps-by-step instructions from the scratch to work and copy and paste code for VB.NET into your editor. Enjoy writing a code with ready-to-use sample VB.NET codes to add gui example for barcode reading with barcode reader sdk functions using ByteScout Premium Suite in VB.NET.
If you want to try other samples for VB.NET then free trial version of ByteScout Premium Suite is available on our website.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
Partial Class Form1
''' <summary>
''' Required designer variable.
''' </summary>
Private components As System.ComponentModel.IContainer = Nothing
''' <summary>
''' Clean up any resources being used.
''' </summary>
''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
Protected Overrides Sub Dispose(disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
#Region "Windows Form Designer generated code"
''' <summary>
''' Required method for Designer support - do not modify
''' the contents of this method with the code editor.
''' </summary>
Private Sub InitializeComponent()
Me.label1 = New System.Windows.Forms.Label()
Me.buttonBrowse = New System.Windows.Forms.Button()
Me.pictureBoxBarcode = New System.Windows.Forms.PictureBox()
Me.textBoxFileName = New System.Windows.Forms.TextBox()
Me.textBoxResults = New System.Windows.Forms.TextBox()
Me.label2 = New System.Windows.Forms.Label()
Me.openFileDialog = New System.Windows.Forms.OpenFileDialog()
Me.checkBoxAll1D = New System.Windows.Forms.CheckBox()
Me.checkBoxAll2D = New System.Windows.Forms.CheckBox()
Me.buttonSearch = New System.Windows.Forms.Button()
Me.panel1 = New System.Windows.Forms.Panel()
DirectCast(Me.pictureBoxBarcode, System.ComponentModel.ISupportInitialize).BeginInit()
Me.panel1.SuspendLayout()
Me.SuspendLayout()
'
' label1
'
Me.label1.AutoSize = True
Me.label1.Location = New System.Drawing.Point(9, 9)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(120, 13)
Me.label1.TabIndex = 0
Me.label1.Text = "Image or PDF file name:"
'
' buttonBrowse
'
Me.buttonBrowse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.buttonBrowse.Location = New System.Drawing.Point(792, 23)
Me.buttonBrowse.Name = "buttonBrowse"
Me.buttonBrowse.Size = New System.Drawing.Size(78, 23)
Me.buttonBrowse.TabIndex = 0
Me.buttonBrowse.Text = "Browse..."
Me.buttonBrowse.UseVisualStyleBackColor = True
AddHandler Me.buttonBrowse.Click, New System.EventHandler(AddressOf Me.buttonBrowse_Click)
'
' pictureBoxBarcode
'
Me.pictureBoxBarcode.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.pictureBoxBarcode.Location = New System.Drawing.Point(0, 0)
Me.pictureBoxBarcode.Name = "pictureBoxBarcode"
Me.pictureBoxBarcode.Size = New System.Drawing.Size(138, 113)
Me.pictureBoxBarcode.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Me.pictureBoxBarcode.TabIndex = 2
Me.pictureBoxBarcode.TabStop = False
'
' textBoxFileName
'
Me.textBoxFileName.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.textBoxFileName.Location = New System.Drawing.Point(12, 25)
Me.textBoxFileName.Name = "textBoxFileName"
Me.textBoxFileName.[ReadOnly] = True
Me.textBoxFileName.Size = New System.Drawing.Size(774, 20)
Me.textBoxFileName.TabIndex = 0
'
' textBoxResults
'
Me.textBoxResults.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.textBoxResults.Location = New System.Drawing.Point(12, 486)
Me.textBoxResults.Multiline = True
Me.textBoxResults.Name = "textBoxResults"
Me.textBoxResults.ScrollBars = System.Windows.Forms.ScrollBars.Both
Me.textBoxResults.Size = New System.Drawing.Size(858, 102)
Me.textBoxResults.TabIndex = 4
'
' label2
'
Me.label2.AutoSize = True
Me.label2.Location = New System.Drawing.Point(12, 470)
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(87, 13)
Me.label2.TabIndex = 5
Me.label2.Text = "Found barcodes:"
'
' openFileDialog
'
Me.openFileDialog.Filter = "Image and PDF files|*.bmp;*.gif;*.tif;*.tiff;*.png;*.jpg;*.jpeg;*.pdf|All files|*" & ".*"
'
' checkBoxAll1D
'
Me.checkBoxAll1D.AutoSize = True
Me.checkBoxAll1D.Checked = True
Me.checkBoxAll1D.CheckState = System.Windows.Forms.CheckState.Checked
Me.checkBoxAll1D.Location = New System.Drawing.Point(12, 51)
Me.checkBoxAll1D.Name = "checkBoxAll1D"
Me.checkBoxAll1D.Size = New System.Drawing.Size(359, 17)
Me.checkBoxAll1D.TabIndex = 1
Me.checkBoxAll1D.Text = "One-dimensional (linear) barcodes (Code39, Code128, GS1, EAN, etc.)"
Me.checkBoxAll1D.UseVisualStyleBackColor = True
'
' checkBoxAll2D
'
Me.checkBoxAll2D.AutoSize = True
Me.checkBoxAll2D.Checked = True
Me.checkBoxAll2D.CheckState = System.Windows.Forms.CheckState.Checked
Me.checkBoxAll2D.Location = New System.Drawing.Point(12, 74)
Me.checkBoxAll2D.Name = "checkBoxAll2D"
Me.checkBoxAll2D.Size = New System.Drawing.Size(363, 17)
Me.checkBoxAll2D.TabIndex = 2
Me.checkBoxAll2D.Text = "Two-dimensional barcodes (Aztec, PDF417, QR Code, Datamatrix, etc.)"
Me.checkBoxAll2D.UseVisualStyleBackColor = True
'
' buttonSearch
'
Me.buttonSearch.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.buttonSearch.Font = New System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CByte(204))
Me.buttonSearch.Location = New System.Drawing.Point(742, 51)
Me.buttonSearch.Name = "buttonSearch"
Me.buttonSearch.Size = New System.Drawing.Size(128, 40)
Me.buttonSearch.TabIndex = 3
Me.buttonSearch.Text = "Search Barcodes"
Me.buttonSearch.UseVisualStyleBackColor = True
AddHandler Me.buttonSearch.Click, New System.EventHandler(AddressOf Me.buttonSearchBarcodes_Click)
'
' panel1
'
Me.panel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.panel1.AutoScroll = True
Me.panel1.BackColor = System.Drawing.SystemColors.ControlDark
Me.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.panel1.Controls.Add(Me.pictureBoxBarcode)
Me.panel1.Location = New System.Drawing.Point(12, 97)
Me.panel1.Name = "panel1"
Me.panel1.Size = New System.Drawing.Size(858, 370)
Me.panel1.TabIndex = 9
'
' Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(882, 600)
Me.Controls.Add(Me.panel1)
Me.Controls.Add(Me.buttonSearch)
Me.Controls.Add(Me.checkBoxAll2D)
Me.Controls.Add(Me.checkBoxAll1D)
Me.Controls.Add(Me.label2)
Me.Controls.Add(Me.textBoxResults)
Me.Controls.Add(Me.textBoxFileName)
Me.Controls.Add(Me.buttonBrowse)
Me.Controls.Add(Me.label1)
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Barcode Reader"
DirectCast(Me.pictureBoxBarcode, System.ComponentModel.ISupportInitialize).EndInit()
Me.panel1.ResumeLayout(False)
Me.panel1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Private label1 As System.Windows.Forms.Label
Private buttonBrowse As System.Windows.Forms.Button
Private pictureBoxBarcode As System.Windows.Forms.PictureBox
Private textBoxFileName As System.Windows.Forms.TextBox
Private textBoxResults As System.Windows.Forms.TextBox
Private label2 As System.Windows.Forms.Label
Private openFileDialog As System.Windows.Forms.OpenFileDialog
Private checkBoxAll1D As System.Windows.Forms.CheckBox
Private checkBoxAll2D As System.Windows.Forms.CheckBox
Private buttonSearch As System.Windows.Forms.Button
Private panel1 As System.Windows.Forms.Panel
End Class
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Windows.Forms
Imports Bytescout.BarCodeReader
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private _fileName As String = ""
Private Sub buttonBrowse_Click(sender As Object, e As EventArgs)
Dim result As DialogResult = openFileDialog.ShowDialog()
If result = DialogResult.OK Then
_fileName = openFileDialog.FileName
textBoxFileName.Text = _fileName
Try
Dim bmp As New Bitmap(_fileName)
pictureBoxBarcode.Image = bmp
Catch generatedExceptionName As Exception
pictureBoxBarcode.Image = Nothing
End Try
End If
End Sub
Private Sub buttonSearchBarcodes_Click(sender As Object, e As EventArgs)
FindBarcodes()
End Sub
Private Sub FindBarcodes()
If String.IsNullOrEmpty(_fileName) Then
Return
End If
Dim reader As New Reader()
reader.RegistrationName = "demo"
reader.RegistrationKey = "demo"
If checkBoxAll1D.Checked Then
reader.BarcodeTypesToFind.All1D = True
End If
If checkBoxAll2D.Checked Then
reader.BarcodeTypesToFind.All2D = True
End If
Cursor = Cursors.WaitCursor
' -----------------------------------------------------------------------
' NOTE: We can read barcodes from specific page to increase performance .
' For sample please refer to "Decoding barcodes from PDF by pages" program.
' -----------------------------------------------------------------------
Dim foundBarcodes As FoundBarcode() = reader.ReadFrom(_fileName)
ResetCursor()
Dim data As New List(Of String)()
If foundBarcodes.Length = 0 Then
data.Add("No barcodes found")
Else
For Each barcode As FoundBarcode In foundBarcodes
data.Add(String.Format("Type ""{0}"" and value ""{1}""", barcode.Type, barcode.Value))
Next
End If
' Cleanup
reader.Dispose()
textBoxResults.Lines = data.ToArray()
End Sub
End Class
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
Imports System.Collections.Generic
Imports System.Windows.Forms
NotInheritable Class Program
Private Sub New()
End Sub
''' <summary>
''' The main entry point for the application.
''' </summary>
<STAThread> _
Friend Shared Sub Main()
Application.EnableVisualStyles()
Application.SetCompatibleTextRenderingDefault(False)
Application.Run(New Form1())
End Sub
End Class
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: