Our Customers8/11/2014
Contact Us Email: support@barcodelib.com
Home > .NET Barcode > Barcode Generation Guide > VB.NET Barcode Generation Guide - How to encode barcode images using free Visual Basic code
Download Barcode for .NET Suite Trial

VB.NET Barcode Generation Guide

Generating Linear & 2D Barcodes in VB.NET Windows, VB.NET ASP.NET Projects
  • Easy & Simple to generate barcodes in VB.net program without the help of other tools
  • Support barcode generating and encoding in several raster image formats in Visual Basic.NET class
  • Simple & complete VB.net barcode component dll, used by 1000+ .NET developers
  • Compatible with latest barcode symbology standards
  • Create linear barcodes, including Code39, Code128, GS1-128, Interleaved 2 of 5, EAN / UPC
  • Create 2d barcodes, including Data Matrix, PDF-417, & QR-Code in VB.NET
  • Easy to make an order for VB.NET bar coding developer license
This article introduces how to use Barcode for .NET components to generate barcodes in your VB.NET website, VB.NET classes, and VB.NET Windows applications.
BarcodeLib.com provides free .NET Barcode Library DLL trial package to download, so please directly download and test it for your Visual Basic.NET Bar Coding applications.
VB.NET Barcode Generator SDK - Barcode Images Supported
Encode Linear Barcodes:
Encode Matrix Barcodes:
VB.NET Barcode Generates 2D (Matrix) Barcode Symbologies: Data Matrix, PDF417, QR Code.
VB.NET Barcode Generator SDK - Generating Barcodes in VB.NET Class

Install VB.NET Barcode Library DLL

Add Reference BarcodeLib.Barcode.ASP.NET.dll or BarcodeLib.Barcode.WinForms.dll to your vb.net project reference.

Implement

Sample VB code for barcode image generation using VB.NET Bar Coding Control DLL.
     ' Create a linear barcode image object (BarcodeLib.Barcode.Linear)
Dim barcode As BarcodeLib.Barcode.Linear

' Set barcode type to Code 39
barcode.Type = BarcodeLib.Barcode.BarcodeType.CODE39

' Set your encoded barcode value
barcode.Data = "123456789"

' Other barcode settings
' save barcode image into your system

'Draw barcode image into a PNG file
barcode.drawBarcode("c:/barcode.png")
The above code is written in Visual VB.NET 2005
VB.NET Barcode Generator DLL - Generate Barcodes in VB.NET Web Applications
  1. The first simple way - How to stream barcode image using our Buildin ASP.NET Barcode Application.
    • Under downloaded trial package, copy barcode folder to your IIS folder, e.g. C:\Inetpub.
    • Create a new virtual directory in IIS, named barcode, and link to the above "barcode" folder.
    • Restart IIS.
    • To test your installation, open your web browser and navigate to:
      http://YourDomain:port/barcode/linear.aspx?Type=7&Data=CODE39-123456789012
    • To create barcode image in your aspx or html page, you need pass the url to IMG tag src value.
      For linear barcode
      <img src="http://YourDomain:port/barcode/linear.aspx?Type=7&Data=CODE39-123456789012" />
      or for Data Matrix
      <img src="http://YourDomain:port/barcode/datamatrix.aspx?Data=BarcodeLib87654321&ModuleSize=4&LeftMargin=8&RightMargin=8&TopMargin=8&BottomMargin=8" />
      or for PDF417
      <img src="http://YourDomain:port/barcode/pdf417.aspx?Data=987654321&ModuleSize=3&LeftMargin=6&RightMargin=6&TopMargin=6&BottomMargin=6" />
      or for QRCode
      <img src="http://YourDomain:port/barcode/qrcode.aspx?Data=9876543210&ModuleSize=3&LeftMargin=12&RightMargin=12&TopMargin=12&BottomMargin=12" />
      Using this method, it will not generate any barcode images in your IIS server side.
  2. The second method - How to generate barcode images through ASP.NET Web Form controller.
    1. Install ASP.NET Barcode Controller to your ASP.NET project.
      • Add Reference BarcodeLib.Barcode.ASP.NET.dll to your project.
        There's no need to copy barcoding dll to your project bin folder because Visual Studio will do it for you during project compilation time.
    2. Add ASP.NET barcode library control to your Visual Studio Toolbox.
      • Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
      • Right click Toolbox and click menu Choose Items...
      • Goto .NET Framework Components tab.
      • If no BarcodeLib component found, click Browse... button and select BarcodeLib.Barcode.ASP.NET.dll file.
      • Then sort "Namespace" column and you will find 4 components from BarcodeLib.Barcode.
      • Check component LinearASPNET, and its namespace is BarcodeLib.Barcode.
      • Check component DataMatrixASPNET, and its namespace is BarcodeLib.Barcode.
      • Check component PDF417ASPNET, and its namespace is BarcodeLib.Barcode.
      • Check component QRCodeASPNET, and its namespace is BarcodeLib.Barcode.
      • Click "OK" button to see the four components under "General": LinearASPNET, DataMatrixASPNET, PDF417ASPNET, QRCodeASPNET.
    3. Go to "barcode" folder in the trial package, then copy files "linear.aspx", "linear.aspx.cs", "datamatrix.aspx", "datamatrix.aspx.cs", "pdf417.aspx", "pdf417.aspx.cs", "qrcode.aspx", "qrcode.aspx.cs" to the same folder as your aspx page, which will generate barcodes.
    4. You can drag LinearASPNET on your aspx page and change barcode setting through properties window.
    5. Run the project. You will find barcode images generated in your aspx pages.
VB.NET Barcode Generator DLL - Generates Barcode in VB.NET Windows Applications
  1. Add Reference BarcodeLib.Barcode.WinForms.dll to your project. There's no need to copy barcoding dll to your project bin folder because Visual Studio will do it for you during project compilation time.
    • In your .NET windows project, right click mouse over Refereces in your Solution Explorer window. Then click menu "Add Reference ...".
    • Add BarcodeLib.Barcode.WinForms.dll to your project.
  2. Add .NET WinForms barcode library component to your Visual Studio Toolbox.
    • Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
    • Right click Toolbox and click menu Choose Items...
    • Goto .NET Framework Components tab.
    • If no BarcodeLib component found, click Browse... button and select BarcodeLib.Barcode.WinForms.dll file.
    • Then sort "Namespace" column. You will find 4 components from BarcodeLib.Barcode.
    • Check component LinearWinForm, and its namespace is BarcodeLib.Barcode.
    • Check component DataMatrixWinForm, and its namespace is BarcodeLib.Barcode.
    • Check component PDF417WinForm, and its namespace is BarcodeLib.Barcode.
    • Check component QRCodeWinForm, and its namespace is BarcodeLib.Barcode.
    • Click "OK" button and you will find four components under "Common Controls": LinearWinForm, DataMatrixWinForm, PDF417WinForm, QRCodeWinForm.
  3. Now you can see the component displayed on Toolbox. Then, you can drag LinearWinForm on your form and change barcode setting through properties window.
Other Barcode Related Articles