The requested page is not available for the requested platform. You are viewing the content for Default platform.

Code 39 (USD-3)

Short Description

Code 39, the first alpha-numeric symbology to be developed, is still widely used, particularly in non-retail environments. It is the standard bar code used by the United States Department of Defense, and is also used by the Health Industry Bar Code Council (HIBCC). Code 39 is also known as "3 of 9 Code" and "USD-3".

Barcode - Code 39

Bar Code Properties

The type of a bar code control's Symbology property is Code39Generator.

The following properties are specific to the Code 39 type.

Examples

The following code creates a Code 39 (USD-3) 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 CreateCode39BarCode(string BarCodeText) {
    // Create a bar code control.
    XRBarCode barCode = new XRBarCode();

    // Set the bar code's type to Code 39.
    barCode.Symbology = new Code39Generator();

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

    // Adjust the properties specific to the bar code type.
    ((Code39Generator)barCode.Symbology).CalcCheckSum = false;
    ((Code39Generator)barCode.Symbology).WideNarrowRatio = 2.5F;

    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(CreateCode39BarCode("012345678"));
}