Last Updated on November 10, 2022 by Humera hallari
To create a Barcode using Visual Basic VB.NET is certainly very easy when you have a simple library. Barcodes themselves are usually used to store important and unique information in the form of the identity of goods that with one and the other are not the same.
By using barcodes will make it easier when inputting the identity of goods in a software. In addition, barcodes will significantly reduce input errors that are common when done manually.
How to Create a Barcode in VB.NET
1) Download the Barcode Library below this article. Then extract first, and in it there is a file called “MessagingToolkit.Barcode.dll“.
2) Open your Visual Studio, create a project with VB.NET Windows Form Application.
3) Right-click on the “References” menu, then you select “Add Reference“. Then point to the “MessagingToolkit.Barcode.dll” file that you have downloaded earlier.
4) Add it to the form, a button, picturebox, and textbox.
5) Double-click on the button and copy paste code below.
Dim gbarcode As New MessagingToolkit.Barcode.BarcodeEncoder Try Dim barcodeimage As Image barcodeimage = New Bitmap(gbarcode.Encode(MessagingToolkit.Barcode.BarcodeFormat.Code128, "DRW8555RE")) e.Graphics.DrawImage(barcodeimage, CInt((e.PageBounds.Width - 150) / 2), 35 + height2, 150, 35) Catch ex As Exception MsgBox(ex.Message) Exit Sub End Try
6) Done, you can use this barcode in your project.
Barcode library is very useful, but it is recommended to use a maximum of 18 digit numbers. In addition, the size of this library is very light. You can download the Barcode library for VB.NET through the following link.