KA.Barcode for .NET WinForms
How to Print Code 39 in .NET WinForms with Valid Data
Complete Code 39 source code to generate Code 39 images using Barcode Generator for .NET WinForms
  • High-quality linear Code 39 barcode generator with full integration in .NET framework
  • Efficiently add 1D Code 39 images with outstanding quality in Windows applications in C#, VB.NET
  • Compatible with ISO/IEC 16388 specification for Code 39 to ensure readability
  • Insert linear and GS1 barcodes , such as UPC-A VB.NET, QR Code ASP.NET, UPC-A .NET WinForms, EAN-13 Word, in your applications
  • Simple to encode 43 ASCII characters including Symbols 0-9, A-Z, and additional punctuations
  • Carry lower case letters using Extended Code 39 barcodes for .NET Windows applications
  • Generating, printing Code 39 with checksum digit automatically added as specified in ISO/IEC standard
  • Supports C# Code 128 , Codabar VB.NET, EAN-13 Java, Interleaved 2 of 5 Word and many other barcode types
  • Provide Sample Code in C# and Sample Code in VB.NET for 1D Code 39 bar code generation
  • Optional checksum calculation as algorithm specified in ISO/IEC standard
KA.Barcode Generator for .NET WinForms is a mature barcode generation component API device with outstanding quality. It supports Code 39 and other 20+ linear and bidimensional barcode image creation in .NET Windows Forms, C#, Visula Basic .NET class & console applications.
From this page, you can get complete guidance on Code 39 data encoding in WinForms with C#, VB.NET programming. Here are two more tutorials with sample codings:
Linear Code 39 Introduction
Code 39 is popular linear barcode symbology also known as Alpha39 because it encodes alphanumeric data. Other commonly used names for Code 39 include Code 3 of 9, Code 3/9, USS Code 39, Type 39, and USD-3.

Code 39 Valid Data

  • Alphanumeric A-Z, 0-9 (ASCII characters 65-90, and 48 to 57 inclusive)
  • Special characters: space $ % + - . /
  • Start/stop character *

Code 39 Extension Valid Data

  • All 128 ASCII characters, including A-Z, a-z, 0-9, and special characters.

Valid Length

  • Both Code 39 and Code 39 Extension have a variable data length.
Code 39 Data Encoding in KA.Barcode Generator for .NET Suite

Install Code 39 Barcode Generator into Your .NET Project

  1. 1.
  2. 2.
    Add Reference: Add "KeepAutomation.Barcode.Window.dll" to your .NET WinForms project reference.
  3. 3.
    Add to Toolbox: Add BarCodeControl to your .NET Visual Studio toolbox.
Copy the following barcode procedure onto your program to create, print Code 39 barcodes in Windows Forms:
using KeepAutomation.Barcode.Bean;

BarCode code39= new BarCode();
code39.Symbology= KeepAutomation.Barcode.Symbology.Code39;
code39.CodeToEncode = "39DATA";
code39.X = 3;
Dim code39 As KeepAutomation.Barcode.Bean.BarCode = New 

code39.Symbology = KeepAutomation.Barcode.Symbology. Code39
code39.CodeToEncode = "39DATA"
code39.X = 3
code39.generateBarcodeToImageFile("C://code39 _vb.png")

Printing Code 39 with Numeric Data

For a Code 39 barcode image, valid encoding data include upper-case letters A to Z and numeric digits 0 to 9. You can choose to encode numeric digits only with the demo code below. Copy it to convert numeric string into a Code 39 barcode image.
code39.CodeToEncode = "3939"; 
code39.CodeToEncode = "3939" 

Encoding AlphaNumeric Data in Code 39

A typical Code 39 barcode, as required in the ISO/IEC specification, can encode only upper-case letters A to Z and numeric digits 0 to 9. You can follow the demo code below to transform alphanumeric data text into a Code 39 bar code.
code39.CodeToEncode = "CODE39"; 
code39.CodeToEncode = "CODE39"

How to Encode Valid Data for Code 39 Extension

A Code 39 Extension, as the name suggests, can encode not only uppercase letters, numeric digits, but also lowercase letters. Hers is the demo code for Code 39 Extension data encoding with alphanumeric data text.
using KeepAutomation.Barcode.Bean;
BarCode code39= new BarCode();
code39. Symbology = Symbology. Code39ex;
code39.CodeToEncode = "Code39";
Dim code39 As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode
code39.Symbology = KeepAutomation.Barcode.Symbology. Code39ex
code39.CodeToEncode = "Code39"

Code 39 Optional Check Digit Encoding

Though Code 39 does not require an obligatory checksum, however, a modulo 43 check digit may be added to increase data integrity. KA.Barcode Generator for .NET WinForms can automatically calcualte Code 39 checksum as required in specifications. Here is the demo code.
code39.ChecksumEnabled = true;
code39.ChecksumEnabled = true
Code 39 Data Encoding with Drag & Drop BarcodeControl
  1. 1.
    In "Choose Toolbox Items" form, click button "Browse...", and select KeepAutomation.Barcode.Windows.dll.
  2. 2.
    Now a BarCodeControl is added into your toolbox.
  3. 3.
    Drag and drop the BarCodeControl into the Forms and a Codabar image is generated.
  4. 4.
    Find Symbology" in the property panel and select "Code39" or "Code39ex".
  5. 5.
    Then input numeric, alphanumeric or ASCII characters in "CodeToEncode" blanket.
  6. 6.
    A Code 39 or Code 39 Extension barcode with different characters is successfully created!