Compatibility & Requirement
- .NET Development Environments: Visual Studio 2005/2008/2010, .NET Version 2.0 or above, IIS (Microsoft Internet Information Services), C#.NET, or VB. NET
- Projects Types Included: Windows Forms Application, .NET Console Application, .NET Class Library and Windows Services
- Applicable Operating Systems: Windows 2000, Windows 2007, Windows Vista & Windows XP
- Minimum Application Demands: 500MHZ processor, 128MB RAM, 5MB available hard drive space
- Microsoft Windows XP
- Microsoft Visual Studio 2005
- Visual C#.NET
KA.Barcode Generator for .NET Windows Forms is a powerful and flexible .NET control dll which is designed and developed for Windows Forms development. It allows .NET developers, especially C#.NET developers, to simply add advanced barcode generation function into .NET Windows Forms projects and other types of .NET applications. This tutorial will show you how to generate or assign barcode images in Visual Studio by using C#.NET programming.
It is available for implementers to download dynamic freeware Barcode Generation Component SDK demo version for free. Barcode generation tutorial and sample codes are provided in this page. Besides, perpetual and royalty-free license is offered. Barcode picture or image formats can be customized. Additionally, multiple barcode image settings are also supported, like barcode width, check digit, character numbers, etc.
How to Generate Barcodes in .NET WinForms Using C#
Choice 1: Drag and Drop Barcode to WinForms Using C#.NET
- Open Microsoft Visual Studio.
- Create a Windows Forms application using the installed project template in C#.
- Copy KeepAutomation.Barcode.Windows.dll to your WinForms project folder (There is no need to copy the dll to .NET bin directory for Visual Studio will do so).
- Add BarcodeControl to your Visual Studio Toolbox.
- Find component BarcodeControl in the Toolbox, drag and drop it to your forms in C#.NET IDE.
- Drag a button to the form and double click to write the following C# demo code.
C# Sample code
BarCode barcode = new BarCode();
barcode.Symbology = KeepAutomation.Barcode.Symbology.UPCA;
barcode.CodeToEncode = "12457182140";
barcode.X = 2;
barcode.Y = 30;
barcode.TopMargin = 10;
barcode.BottomMargin = 10;
barcode.LeftMargin = 10;
barcode.RightMargin = 10;
barcode.DisplayText = true;
barcode.DisplayStartStop = true;
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel;
barcode.Orientation = KeepAutomation.Barcode.Orientation.Degree90;
barcode.DPI = 72;
barcode.ImageFormat = ImageFormat.Bmp;
barcode.generateBarcodeToImageFile("C://barcode-upca-csharp.bmp");
Choice 2: Create Barcode Image in WinForms Using C#.NET
- Create a Windows Forms Application using template C# project in your Visual Studio.
- Add KeepAutomation.Barcode.Windows.dll to the C# WinForms project reference.
- Drag and drop a button from the Toolbox to the form, and double click the button.
- Copy the following sample code, and paste it to the Form1.cs.
C# Sample code
BarCode barcode = new BarCode();
barcode.Symbology = KeepAutomation.Barcode.Symbology.UPCA;
barcode.CodeToEncode = "84325785412";
barcode.X = 1;
barcode.Y = 30;
barcode.BarCodeWidth = 150;
barcode.BarCodeHeight = 80;
barcode.DisplayText = true;
barcode.DisplayStartStop = true;
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel;
barcode.Orientation = KeepAutomation.Barcode.Orientation.Degree0;
barcode.DPI = 72;
barcode.ImageFormat = ImageFormat.Bmp;
barcode.generateBarcodeToImageFile("C://barcode-upca-csharp.bmp");