Our Customers
Contact Us Email: support@barcodelib.com
Home > ASP.NET Barcode> Barcode Generation Guide> ASP.NET Barcode Generation Guide in VB.NET
Download Barcode for ASP.NET Trial

How to Generate Barcode in ASP.NET using VB.NET

Barcode for ASP.NET - How to Use Free VB Code to Encode 1D & 2D Barcodes for ASP.NET Web
  • Advanced and affordable barcoding library for ASP.NET since 2003
  • Quick to generate barcodes in VB.NET using this strong named BarcodeLib.Barcode.ASP.NET.dll
  • Quick to integrate advanced barcode generation features into ASP.NET Class, ASP.NET Web & IIS
  • Use VB.NET code to generate and save linear & 2d barcode images for web application
  • Use VB.NET code to set & adjust encoded barcode parameters, like image size, color, rotation, etc
  • All created 1d & 2d barcodes comply with the latest barcode standards
ASP.NET VB Barcode Creation Prerequisites
  • BarcodeLib.Barcode.ASP.NET.dll
  • Microsoft .NET Framework 2.0 or greater
  • Visual Studio .NET 2005 or greater
Generate Barcode Image in ASP.NET Web Application using VB.NET

Install

  1. In your .NET project, click "Project" and select "Add Reference".
  2. In the "Add Reference" table, click "Browse" to find the BarcodeLib.Barcode.ASP.NET.dll in the unzipped trial version package.
  3. Click "OK" and you have successfully add the dll to your VB.NET project reference.

Implement

When installation is done, you can input VB.NET code for barcode printing in ASP.NET. Below is some simple Visual Basic (VB.NET) demo code for generating EAN-13 linear barcodes.
     Dim barcode As BarcodeLib.Barcode.Linear
barcode = New BarcodeLib.Barcode.Linear()
barcode.Data = "11223344556612"
barcode.BarWidth = 2
barcode.BarHeight = 65

barcode.TopMargin = 5
barcode.BottomMargin = 5
barcode.LeftMargin = 5
barcode.RightMargin = 5

barcode.Rotate = BarcodeLib.Barcode.RotateOrientation.BottomFacingDown
barcode.Resolution = 72
barcode.UOM = BarcodeLib.Barcode.UnitOfMeasure.PIXEL
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png

barcode.drawBarcode("c:/barcode.png")

' generate barcode & output to byte array
byte[] barcodeInBytes = barcode.drawBarcodeAsBytes()

' generate barcode to Graphics object
Graphics graphics = ...
barcode.drawBarcode(graphics)

' generate barcode and output to Bitmap object
Bitmap barcodeInBitmap = barcode.drawBarcode()

' generate barcode and output to HttpResponse object
HttpResponse response = ...
barcode.drawBarcode(response)

' generate barcode and output to Stream object
Stream stream = ...
barcode.drawBarcode(stream)
More Methods to Generate Barcodes in VB.NET ASP.NET

Generate Barcodes with Web Controller

This method allows you to create barcodes in ASP.NET web site by drag-n-drop the barcode control to aspx pages. Barcode dimensions can be easily adjusted through the Properties table on the right. Please follow the steps below to have a try.
  1. First please unzip the downloaded evaluation package, and copy the .aspx and .aspx.cs files you will use to the ASP.NET web site where you will generate barcodes on.
  2. Then open your Visual Studio, right click in toolbox, and select "Choose Items...".
  3. Add BarcodeLib.Barcode.ASP.NET.dll to toolbox.



  4. Now four barcoding items are added to toolbox, and you can drag them to your aspx pages for barcode generation.
  5. Run the project and the barcode is created!

Stream Barcodes with Without Web Controller

This method enables web developers / designers to generate barcodes through Microsoft Internet Information Service (IIS). You can easily specify barcode image (in Jpg, Png, Gif, Bmp, etc) in URL, which can used for other operating systems and development environments.

In addition, installation of this control is quite easy. Just follow the procedures for a barcoding test.
  1. Unzip the trial package and copy barcode folder and its contents to your IIS folder.
  2. Create a new virtual directory in IIS, name it barcode, and link it to the formerly pasted "barcode" file.
  3. Restart IIS. To test the installation, just open your web browser and navigate to:
    http://YourDomain:Port/barcode/linear.aspx?Type=7&Data=CODE39-123456789012
  4. If you want to insert the barcode image in other aspx or html page, you need to 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=BarcodeLib12345678&ModuleSize=4&LeftMargin=8&RightMargin=8&TopMargin=8&BottomMargin=8" />
    or for PDF417
    <img src="http://YourDomain:port/barcode/pdf417.aspx?Data=123456789&ModuleSize=3&LeftMargin=6&RightMargin=6&TopMargin=6&BottomMargin=6" />
    or for QRCode
    <img src="http://YourDomain:port/barcode/qrcode.aspx?Data=0123456789&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.
ASP.NET Barcode Generator Library - Supported Barcodes
  • Create Linear Barcode Images for ASP.NET Web
    ASP.NET 1D Barcodes:


  • Create Matrix Barcode Images for ASP.NET Web
    ASP.NET 2D Barcodes:

Other Related .NET Barcode Generator Libraries