Barcode for .NET WinForms > Generate Barcode in C#

How to Add Barcode Images in WinForms Using C#

How to Generate Barcodes in .NET WinForms Applications Using Free C# Code
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
Test Environment
  • 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#
Our website offers two choices for generating barcode images in .NET Windows Forms and detailed operation steps are shown below. Please download KeepAutomation Barcode Generator for .NET WinForms and unzip it for evaluation.
Choice 1: Drag and Drop Barcode to WinForms Using C#.NET
  1. Open Microsoft Visual Studio.
  2. Create a Windows Forms application using the installed project template in C#.
  3. 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).
  4. Add BarcodeControl to your Visual Studio Toolbox.
  5. Find component BarcodeControl in the Toolbox, drag and drop it to your forms in C#.NET IDE.
  6. 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
  1. Create a Windows Forms Application using template C# project in your Visual Studio.
  2. Add KeepAutomation.Barcode.Windows.dll to the C# WinForms project reference.
  3. Drag and drop a button from the Toolbox to the form, and double click the button.
  4. 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");

CompatibilityTest EnvironmentWinForms C# BarcodingUsing C#Using VB.NETData Matrix for .NET WinFormsPDF417 for .NET WinFormsQR Code for .NET WinFormsmoreCodabar for .NET WinFormsCode 39 for .NET WinFormsCode 128 for .NET WinFormsEAN-8 for .NET WinFormsEAN-13 for .NET WinFormsEAN 128 for .NET WinFormsIntelligent Mail for .NET WinFormsInterleaved 2 of 5 for .NET WinFormsISBN for .NET WinFormsITF-14 for .NET WinFormsRM4SCC for .NET WinFormsUPC-A for .NET WinFormsUPC-E for .NET WinFormsmore
KeepAutomation provides complete barcode automation solutions for add barcode display 2-dimensional, barcode generation capacity api, and barcode mobile applications. We recommend the customers use high quality ASP.NET html5 document viewer, c# pdf sdk, C# merge PDF files, Split PDF in C#, C# View, edit PDF online , C# Convert PDF to Tiff, C# Convert PDF to text, txt, .net imaging sdk, C# PDF metadata edit from RasterEdge.com.