How to Generate & Save Barcode in .NET Windows Forms
- Add .NET Barcode Generator DLL for WinForms to Toolbox.
Detailed steps for installation are as follows: Create a new .NET Windows Forms project, right-click Toolbox, select Choose Items..., and click Browse... to find OnBarcode.Barcode.WinForms.dll. Then, four related items will appear in the Toolbox: LinearWinForm, DataMatrixWinForm, PDF417WinForm, and QRCodeWinForm. - Drag & drop DataMatrixWinForm Windows Forms if users want to generate & print a Data Matrix barcode image in .NET WinForms.
Drag & drop QRCodeWinForm Windows Forms if users want to create QR Code barcode image in .NET WinForms.
Drag & drop PDF417WinForm Windows Forms if users want to create & save PDF417 barcode in .NET WinForms.
Drag & drop LinearWinForm Windows Forms if users want to generate & print any of the linear barcodes like Code 39, Code 128, EAN-13, GS1-128, ISBN, UPC-A, in .NET WinForms. - Developers can also get data from a textbox in VB.NET configuration or create propriety barcode in picturebox.
You can easily adjust barcode value (such as width and height) and other designing functions in the property table.
How to Encode Barcode in .NET WinForms Using VB.NET Code
- Integrate .NET WinForms Barcode Library DLL to Windows VB.NET project reference.
- Use OnBarcode.Barcode as the namespace and copy the following VB.NET sample codes to VB.NET class.
The VB.NET API demo code below shows how to encrypt a square barcode Data Matrix encoding lowercase alphanumeric character string via VB. More methods are provided to display, retrieve, apply or store a barcode image.
' Create a .NET WinForms Data Matrix object
Dim datamatrix As New DataMatrix()
' Set Data Matrix encoded data
datamatrix.Data = ".NET WinForms VB.NET Data Matrix"
' Set Data Matrix data mode
datamatrix.DataMode = DataMatrixDataMode.Auto
' Set Data Matrix barcode image size
datamatrix.X = 3
datamatrix.LeftMargin = 6
datamatrix.RightMargin = 6
datamatrix.TopMargin = 6
datamatrix.BottomMargin = 6
' Print Data Matrix to gif image file and save it to C:\
datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif
datamatrix.drawBarcode("C://winfroms-vb-net-datamatrix.gif" )
VB.NET Barcode Generation Tutorials for Supported Barcodes
Barcode SDK for VB.NET - Barcode Image Generation
- Visual Basic .NET Linear Barcode Images:
- Visual Basic 2D Barcode Images: Data Matrix, PDF417, QR Code, Micro PDF417, Micro QR Code
