KA.Barcode for .NET Suite
How to Generate Code 2 of 5 in .NET Application
How to create & add linear Code 2 of 5 barcode images in C#, VB.NET, ASP.NET web, and Windows Forms projects
  • Entirely integrate barcode generator control into Visual Studio 2005, 2008 and 2010
  • Completely developed and built in managed C#.NET code
  • Advanced and mature barcode generator SDK Library for ASP.NET and .NET WinForms
  • Supporting printing linear and matrix barcode types for .NET applications
  • Deploy component to add Code 2 of 5barcodes within a few seconds
  • Create Code 2 of 5 barcode images in console applications using C# or VB.NET
  • It is allowed for users to customize created Code 2 of 5 image properties
  • Purchase with flexible and perpetual royalty-free developer licenses
Code 2 of 5 barcode control dll is often used to implement barcode images for .NET application without other barcode fonts. And using C# or VB.NET to generate and modify Code 2 of 5 barcode images is easy for users. Moreover, KA.Barcode for .NET Suite supports various projects, such as ASP.NET web applications, Windows Forms, Visual C# and VB Class Library, Console Applications, etc.
Code 2 of 5 Overview in .NET Generator
Code 2 of 5, also known as Code 25, Industrial 2 of 5, IATA 2 of 5, Data Logic 2 of 5, Matrix 2 of 5, COOP 2 of 5, is a simple low-density numeric barcode symbology. It has been used in the photofinishing and warehouse sorting industries, as well as sequentially numbering airline tickets.

Code 2 of 5 Barcode Data in .NET SDK

  • Numeric digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Code 2 of 5 Generation in .NET Component
Firstly, please download KA.Barcode for .NET Suite evaluation for free and unzip.

How to Drag Code 2 of 5 Barcode SDK to .NET Project

  1. 1.
    Open a Visual Studio, create a new project, and activate the toolbox panel
  2. 2.
    Right-click "Components" -> "Choose Items...", and click "Browse..."
  3. 3.
    Select "KeepAutomation.Barcode.Web.dll" or "KeepAutomation.Barcode.Windows.dll", and then click "Open"
  4. 4.
    You can see "BarCodeControl" in toolbox, and drag it to web or windows form to add a Code 128 barcode image
  5. 5.
    Change barcode type to "Code2of5" and revise other properties in the "Properties", then click the generated barcode

How to Create Code 2 of 5 in C# or VB.NET Class

The C# or VB.NET sample code below is provided to generate and produce Code 2 of 5 for ASP.NET web application and Windows Form application.

using KeepAutomation.Barcode.Bean;

BarCode code25= new BarCode();
code25.Symbology= KeepAutomation.Barcode.Symbology.Code2of5;
code25.CodeToEncode = "2525";
code25.WideNarrowRatio = 2f;
code25. X=3;
code25.generateBarcodeToImageFile("C://code25-csharp.png"

Dim code25 As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

code25.Symbology= KeepAutomation.Barcode.Symbology.Code2of5
code25.CodeToEncode = "2525"
code25.WideNarrowRatio=2.75f
code25. X=3
code25.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif()
code25.generateBarcodeToImageFile("C://code25-vb-net.gif"

How to Add Code 2 of 5 with Wide to Narrow Bar in .NET

To read the encoded information in a barcode reliably, the decoder must be able to make difference between the wide and narrow bars. So, Wide Bar to Narrow Bar Ratio, also known as the N dimension, is designed for Code 2 of 5. Users can use C# or VB.NET to modify the ratio value in .NET application. Ratio values from 2f, 2.5f, 2.75f and 3f are recommended.

code25. WideNarrowRatio = 2.75f;

code25. WideNarrowRatio = 2.75f
How to Generate Code 2 of 5 in Microsoft IIS with URL
  1. 1.
    Download and unzip KA.Barcode for .NET Suite trial package
  2. 2.
    Copy "barcode" and its contents to Microsoft IIS and create a new virtual directory "barcode"
  3. 3.
    Click stop item and start item successively, and navigate to "http://localhost/barcode/barcode.aspx?code-to-encode=2525&symbology=2"
  4. 4.
    After this, Code 2 of 5 will be created and you can make adjustment for the barcode image in the url with the http parameters
  5. 5.
    Just insert <img src="http://localhost/barcode/barcode.aspx?code-to-encode=2525&symbology=2"/> into your web pages, the created barcodes can be added in html or aspx pages