VB.NET Barcode Generator SDK Tutorial
Generate, create linear, 2d barcode images in Visual Basic .NET application

Generate, Create, Print, Draw linear, 2D Bar codes in VB.NET Projects

  • Create barcodes in VB.NET Class & Console application
  • Generate barcode images in VB.NET ASP.NET web project
  • Draw barcodes in VB.NET Windows Forms software
  • Print barcodes in Reporting Services & Crystal Reports document
  • Generate & encode barcode images to Jpeg, Gif, Tiff, Bitmap formats
  • Completely support in .NET 2.0 and later versions
  • Generating 2d (matrix) barcode images, including QR Code, PDF-417, Data Matrix.
  • Creating linear (1d) barcode images, including Code 39, Code 128, EAN-13, GS1-128, ITF-14, UPC-A.
  • Mature VB.NET barcode generating component SDK

How to create, print linear, 2d barcodes in Windows Forms, WPF application using VB.NET?

  1. Download VB.NET Barcode Generator SDK
  2. Install Visual Basic library to generate barcodes in .NET console and Windows Projects
  3. Step by Step Tutorial








OnBarcode provides several DLLs in .NET Barcode Generator Control SDK for generating linear & 2d barcodes in Microsoft Visual Basic .NET applications. This article helps VB.NET professionals choose the right barcode generating component for your VB.NET development environment.To verify the generated barcodes, you can use our .NET Barcode Reader SDK to read and decode barcode in VB.NET.




Quick to generate barcode in VB.NET class

Top

Create barcode in image file

Using VB.NET Barcode Generator library, you can quickly create and print a barcode to an image file in your vb.net class, console, Windows Forms application.
  • Create a Linear object for 1d barcode generation
  • Define the barcode encoding data in property Data
  • Define the 1d barcode format in property Type
  • Call method drawBarcode() to print encoded Code 128 barcode to a png image file
Dim barcode = New Linear()
barcode.Data = "Code 128"
barcode.Type = BarcodeType.CODE128
barcode.drawBarcode("C://Output//vb-net-barcode-how-to-demo.png")





Print barcode in VB.NET memory object

You can also create and draw barcode to a VB.NET object (such as MemoryStream, System.Drawing.Graphics) in memory, and you can further process the barcode object.

You can also call method public byte[] drawBarcodeAsBytes() to get the printed barcode in byte array.

Dim barcode = New Linear()
barcode.Data = "ABC-123-abc"
barcode.Type = BarcodeType.CODE128
Dim barcodeInStream = New MemoryStream()
barcode.drawBarcode(barcodeInStream)




How to convert digits, text, binary data to barcode using VB.NET?

Top

Convert digits, AlphaNumeric text to barcode

Convert digits and alphanumeric text to barcode using VB.NET is an easy job using VB.NET Barcode library. You pass the encoding digits or alphanumeric text to property Data, and the barcode library will automatically generate the barcode with the encoding data.

Some barcode formats require fixed lengh of digits (such as EAN/UPC, ITF-14), your input barcode text should follow the rules.

The VB.NET sample source code below shows how to create an EAN-13 barcode. You need enter 12 (data only) or 13 (data and one checksum digit) digits to property Data.

Dim barcode = New Linear()
barcode.Data = "123456789012"
barcode.Type = BarcodeType.EAN13
barcode.drawBarcode("C://Output//vb-net-barcode-how-to-convert-digits-barcode.png")





Encode barcode with ASCII chars, Unicode text, GS1, binary data

Besides simple digits and alphanumeric characters encoding, 2d barcodes and some linear barcode (such as Code 128) supports special data encoding such as binary data, non-printable chars, Unicode, GS1 data messages. View details here:
How to generate barcode with ASCII chars, Unicode text, GS1, binary data encoded using VB.NET?




Generate and customize barcode dimension width and height in VB.NET

Top

Quick to customize printed Code 128 barcode image width & height

You can quickly customize and draw barcode with specified image width and height in VB.NET class.

The VB codes below explains how to create and draw a Code 128 barcode image with width in 250 pixels, height in 150 pixels.
  • Set barcode image dimension width size (in pixel by default) through property BarcodeWidth
  • Set barcode image dimension height size (in pixel by default) through property BarcodeHeight
Once you have specified the barcode image width and height, the vb.net barcode library will calculate and choose the maximum bar/space module width and height.

Dim barcode = New Linear()
barcode.Data = "ABC-123-abc"
barcode.Type = BarcodeType.CODE128
barcode.BarcodeWidth = 250
barcode.BarcodeHeight = 150
barcode.drawBarcode("C://Output//vb-net-barcode-how-to-barcode-size.png")





More options to customize barcode image size

Using VB.NET Barcode Generator library API, you can further customize the printed barcode appearance through the following properties in vb codes.
  • AutoResize. If it is true, the barcode library will ignore property X and Y, and the library will calculate and use the maximum bar module width and height
  • UOM. Unit of measure. You can choose inch, cm, or pixel (default).
  • X. Bar/space module width. The property will work, if AutoResize is false.
  • Y. Bar/space module height. The property will work, if AutoResize is false.
  • LeftMargin, RightMargin, TopMargin, BottomMargin. Barcode image margins.
  • BarAlignment. Barcode alignment in the image.
Dim barcode = New Linear()
barcode.Data = "ABC-123-abc"
barcode.Type = BarcodeType.CODE128
barcode.AutoResize = False
barcode.UOM = UnitOfMeasure.PIXEL
barcode.BarcodeWidth = 250
barcode.BarcodeHeight = 150
barcode.Resolution = 300
barcode.X = 1
barcode.Y = 80
barcode.LeftMargin = 0
barcode.RightMargin = 0
barcode.TopMargin = 0
barcode.BottomMargin = 0
barcode.BarAlignment = AlignmentHori.Center
barcode.drawBarcode("C://Output//vb-net-barcode-how-to-barcode-size-detailed.png")





Advanced Barcode Generation and Customization in VB.NET

Top

1D barcode text label customization

Using VB.NET barcode library, you can generate and customize linear (1d) barcode human readable text styles, such as font family, font size, font style, and text and barcode margin space.
  • Set property AutoResizeBarcodeText to false. You can change barcode text font size when this property is disabled.
  • TextFont. You can specify the font name, size, style through Font object.
  • TextColor. Specify the text color in RGB
  • TextMargin. Margin space between text and barcode.

Dim barcode = New Linear()
barcode.Data = "123456789012"
barcode.Type = BarcodeType.EAN13
barcode.AutoResizeBarcodeText = False
barcode.TextFont = New Font("OCR-b", 14.0F, FontStyle.Regular)
barcode.TextColor = Color.Blue
barcode.TextMargin = 5



Hide 1D (linear) barcode text label

Using OnBarcode VB.NET Barcode Generator library, you can easily create linear barcodes without text label printed.

  • Set property ShowText to False to hide 1d barcode text label

barcode.ShowText = False





Barcode color and image settings

You can draw and print barcode with customize colors and image options applied.
  • ForeColor. Barcode bar module color
  • BackColor. Barcode space module color
  • TextColor. 1D barcode text color
  • OutputFileFormat. Specify the barcode output image file format, supports BMP, PNG, JPG, GIF, TIFF, SVG and EPS
You can find more details about barcode color and image options (such as barcode with transparent background-color, CMYK color in EPS) here: How to print barcode using vb.net with colors and image options customized?

Dim barcode = New Linear()
barcode.Data = "CODE39"
barcode.Type = BarcodeType.CODE39
barcode.ForeColor = Color.Red
barcode.BackColor = Color.White
barcode.TextColor = Color.Red
barcode.OutputFileFormat = FileFormat.SVG
barcode.drawBarcode("C://Output//vb-net-barcode-how-to-color-image-options.svg")

Code 39 barcode in SVG viewed in web browser





Print styled QR Code with logo image

Here you will learn how to insert a logo image to the center of QR Code using VB.NET.

Dim barcode = New QRCode()
barcode.Data = "https://www.facebook.com"
barcode.Logo = New System.Drawing.Bitmap("C://Input//facebook_logo_2021.svg.png")
barcode.LogoActualSize = New System.Drawing.SizeF(600, 600)
barcode.ECL = QRCodeECL.M
barcode.UOM = UnitOfMeasure.INCH
barcode.AutoResize = True
barcode.BarcodeWidth = 3
barcode.BarcodeHeight = 3
barcode.Resolution = 900
barcode.AutoResizePaddingTransparent = True
barcode.OutputFileFormat = FileFormat.PNG
barcode.drawBarcode("C://Output//vb-net-barcode-how-to-styled-qrcode.png")





VB.NET Barcode Generator Supported Barcode Symbology Types

Top

Barcode Control for VB.NET - Bar Code Type Generation





































Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.