How to Create Barcodes in VB.NET with a Given Size
Barcode Generator for VB.NET is a .NET Control SDK that enables VB.NET developers to insert dynamic barcodes into Visual Basic .NET development environments, including VB.NET ASP.NET & Windows Applications, VB.NET Class, and VB.NET Console Applications. Barcode Generator for VB.NET supports 30+ linear, and 2D barcodes, including Code 39, Code 128, UPC/EAN barcode, QR Code , Data Matrix, PDF-417, USPS Intelligent Mail, etc.
Besides, developers are easy to customize barcode to fix their specified requirement. The customization of X dimension, wide to narrow ratio, barcode height and other properties with VB.NET are supported. Here is a detailed integration guide for generating your own barcodes in VB.NET applications with given size.
Compatibility & Requirements
.NET Development Environments
- .NET 2.0/3.0/4.0 - C#, Visual Basic, Managed C++ and Borland Delphi .NET - Visual Studio 2005/2008/2010 |
Compatible Project Types
- .NET Windows Forms Application - .NET Class and Console Applications - ASP.NET Web Forms - .NET SSRS and Crystal Report |
Compatibility & Test Environment
Compatible Operating Systems
- Microsoft Windows 7 - Windows Server 2008 - Windows Vista - Windows Server 2003 - Windows XP |
Test Environment
-Microsoft Windows XP -Microsoft Visual Studio 2005 -Visual C#.NET |
How to Create Barcodes in VB.NET with Fixed Bar Width
- Unzip .NET Barcode Generator for VB.NET trial;
- Copy BusinessRefinery.Barcode.Win.dll to your project folder; (Do not copy dll to .NET bin directory; Visual Studio build tools will do it for you.)
- Run Visual Studio .NET and open an existed Windows Application or create a new one;
- Go to "Project" and choose "Add Reference";
- Go to "Browse" and select BusinessRefinery.Barcode.Win.dll;
- In "Choose Toolbox Items" form, click button "Browse...", and select BusinessRefinery.Barcode.Win.dll;
- After selection, you will find four items under "Components" section: WinLinearBarcode, WinDataMatrix, WinPDF417, and WinQRCode;
- Select all of four components. Then these 4 components in your Visual Studio Toolbox;
- Drag and drop "WinQRCode" to your Windows forms;
Sample Code: How to Create Barcodes in VB.NET with Fixed Bar Width
Add the following Sample Code to Form1.cs
Dim barcode As BusinessRefinery.Barcode.QRCode =
New BusinessRefinery.Barcode.QRCode()
barcode.Code = "QR Code"
barcode.AutoSize = false
barcode.BarWidth = 5
barcode.Format = System.Drawing.Imaging.ImageFormat.Gif
barcode.drawBarcode2ImageFile("c:/qr-code.gif")
How to Create Barcodes in VB.NET with Given Image Size
- Unzip .NET Barcode Generator for VB.NET trial;
- Copy BusinessRefinery.Barcode.Win.dll to your project folder; (Do not copy dll to .NET bin directory; Visual Studio build tools will do it for you.)
- Run Visual Studio .NET and open an existed Windows Application or create a new one;
- Go to "Project" and choose "Add Reference";
- Go to "Browse" and select BusinessRefinery.Barcode.Win.dll;
- In "Choose Toolbox Items" form, click button "Browse...", and select BusinessRefinery.Barcode.Win.dll;
- After selection, you will find four items under "Components" section: WinLinearBarcode, WinDataMatrix, WinPDF417, and WinQRCode;
- Select all of four components. Then these 4 components in your Visual Studio Toolbox;
- Drag and drop "WinQRCode" to your Windows forms;
Sample Code: How to Create Barcodes in VB.NET with Given Image Size
Add the following Sample Code to Form1.cs
Dim barcode As BusinessRefinery.Barcode.QRCode =
New BusinessRefinery.Barcode.QRCode()
barcode.Code = "QR Code"
barcode. AutoSize=true
barcode.Width = 150
barcode.Format = System.Drawing.Imaging.ImageFormat.Gif
barcode.drawBarcode2ImageFile("c:/qr-code.gif")