ByteScout Barcode Suite - VB.NET - Gui example for barcode reading with barcode reader sdk - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Barcode Suite – VB.NET – Gui example for barcode reading with barcode reader sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – VB.NET – Gui example for barcode reading with barcode reader sdk

gui example for barcode reading with barcode reader sdk in VB.NET and ByteScout Barcode Suite

gui example for barcode reading with barcode reader sdk in VB.NET

Every ByteScout tool includes sampleVB.NET source codes that you can find here or in the folder with installed ByteScout product. ByteScout Barcode Suite was made to help with gui example for barcode reading with barcode reader sdk in VB.NET. ByteScout Barcode Suite is the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK).

Save time on writing and testing code by using the code below and use it in your application. If you want to know how it works, then this VB.NET sample code should be copied and pasted into your application’s code editor. Then just compile and run it. 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 Barcode Suite in VB.NET.

Visit our website to get a free trial version of ByteScout Barcode Suite. Free trial contains many of source code samples to help you with your VB.NET project.

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

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

Form1.Designer.vb
      
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

ON-PREMISE OFFLINE SDK

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

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Form1.vb
      
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

ON-PREMISE OFFLINE SDK

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

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Program.vb
      
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

ON-PREMISE OFFLINE SDK

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

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 Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next