Skip to main content
A newer version of this page is available. .

Industrial 2 of 5

  • 2 minutes to read

Short Description

Standard 2 of 5 is a low-density numerical bar code that was introduced in the 1960s. It has been used in the photofinishing and warehouse sorting industries, as well as to sequentially number airline tickets.

Barcode - Industrial 2 of 5

Bar Code Properties

The type of a bar code control’s Symbology property is Industrial2of5Generator.

The following properties are specific to the Industrial 2 of 5 type.

Examples

The following code creates an Industrial 2 of 5 bar code and specifies its main properties.

using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateIndustrial2of5BarCode(string BarCodeText) {
    // Create a bar code control.
    XRBarCode barCode = new XRBarCode();

    // Set the bar code's type to Industrial 2 of 5.
    barCode.Symbology = new Industrial2of5Generator();

    // Adjust the main properties of the bar code.
    barCode.Text = BarCodeText;
    barCode.Width = 400;
    barCode.Height = 100;

    // Adjust the properties specific to the bar code type.
    ((Industrial2of5Generator)barCode.Symbology).CalcCheckSum = false;
    ((Industrial2of5Generator)barCode.Symbology).WideNarrowRatio = 3;

    return barCode;
}

To add the XRBarCode to a report band, handle the report’s XRControl.BeforePrint event.

using System.Drawing.Printing;
// ...

private void XtraReport1_BeforePrint(object sender, PrintEventArgs e) {
    this.Detail.Controls.Add(CreateIndustrial2of5BarCode("012345678"));
}