Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Barcode > C# Barcode Generation Guide > C# Code 39 Generator for .NET, ASP.NET
Download Barcode for .NET Suite Trial

C# Code 39 Generator Library for .NET

How to Generate Code 39 Linear Barcodes in .NET applications in Visual C#
  • Integrate Code 39 linear barcode encoding features into Visual Studio .NET Framework 2.0 or greater
  • Generate and draw Code 39 barcodes for .NET applications using Visual C# class library
  • Fully compiled in Visual C#, compatible with Visual Studio 2005, 2008, 2010, etc
  • Easily generate and print barcode Code 39 for .NET Windows Forms and ASP.NET Web Form
  • Create and insert Code 39 1D barcode images on .NET reportings, like Crystal Reports, Reporting Services and RDLC Local Reports
  • Generate high print-quality Code 39 barcodes in memory and in image file formats
  • Generated Code 39 barcode images that comply with the latest ISO / IEC 16388 specification
  • Provide free C# demo code to customize Code 39 barcode shape, size, color easily
  • Provide multiple license options for this professional C# Barcode Generator .NET Control
C# Code 39 Barcode Introduction
Linear Barcode Code 39 is also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3.
Compatibility: Code 39 barcodes generated by this .NET Barcode Generator SDK comply with ISO / IEC 16388 (2nd edition 2007-05-15) bar code specification.
Code 39 barcode is a linear barcode symbology developed by Dr. David Allais and Ray Stevens of Intermec in 1974. Nowadays, Code 39 is widely adopted in Non-retail environments, U.S. Government and military use and Health Industry Bar Code Council (HIBCC)).
Code 39 bar code is able to encode 43 characters: A-Z, 0-9, 7 special chars [-(Dash), $(Dollar), %(Percentage), (Space), .(Point), /(Slash), +(Plus)], and 1 start/stop characters (*).
For more Code 39 information, please see .NET Code 39 Barcode Introduction
How to Generate Code 39 BarCode Using C# Class Library?

How to Install

  1. Add Barcodelib.Barcode.ASP.NET.dll or BarcodeLib.Barcode.WinForms.dll to your C# project reference.
    • Click "Project" and select "Add Reference...".
    • Click "Browse" to find your unzipped above two dll and click "OK" button.
  2. Add BarcodeLib barcoding dlls to Visual Studio Toolbox.
    • Right click in Toolbox and select "Choose Items...".
    • In the pop-up window, click "Browse..." to locate the dll BarcodeLib.Barcode.WinFroms.dll or Barcodelib.Barcode.ASP.NET.dll.
    • Click "OK" and you will find four items listed in VS Toolbox, for example: LinearWinForm, DataMatrixWinForm, PDF417WinForm, and QRCodeWinForm. And now it's done!

How to Implement

We provide following C# sample code for you. With the code below, you can generate a sample Code 39 barcode image in .NET projects using Visual C# class library.
In addition, please feel free to customize the image using advanced Code 39 barcoding features.
     BarcodeLib.Barcode.Linear code39 = new BarcodeLib.Barcode.Linear();
code39.Type = BarcodeType.CODE39;
code39.Data = "CODE39-393939393939";

code39.N = 3;
code39.AddCheckSum = true;
code39.UOM = UnitOfMeasure.PIXEL;

// More barcode settings here, like image color, font, human-readable text font etc.

// save barcode image into your system

// Create Code 39 barcode & output to byte array
byte[] barcodeInBytes = code39.drawBarcodeAsBytes();

// Create Code 39 barcode to Graphics object
Graphics graphics = ...;

// Create Code 39 barcode and output to HttpResponse object
HttpResponse response = ...;

// Create Code 39 barcode and output to Stream object
Stream stream = ...;
Above Free Code 39 sample code is written in Visual C# 2005
How to Create Code 39 Image in ASP.NET Web Applications in C# Generator?
With this C# Code 39 generator component, you can stream Code 39 barcode images in ASP.NET in two ways.
  1. Method 1: The simplest way for Code 39 barcode generation is through BarcodeLib Buildin ASP.NET Barcode Application.
    • Unzip the downloaded evaluation package, and copy barcode folder and its contents to your IIS folder, eg. C:\inetpub.
    • Create a new virtual directory in your IIS, name it "barcode", and connect it to the above "barcode" folder in inetpub.
    • Restart IIS for a barcoding test.
    • To test your installation, open your web browser and navigate to:
      For further Code 39 barcode setting, please view more web stream Code 39 URL parameters here: Code 39 .NET Generator DLL Property Settings.
    • To insert this Code 39 image in your aspx or html page, simply pass the url to IMG tag or src value.
      For example:
      <img src=http://YourDomain:port/barcode/linear.aspx?Type=7&Data=CODE39-39393939&LeftMargin=8&RightMargin=8 />
      This method will not generate any barcode images in your IIS server side.
  2. Method 2: Another method is to generate Code 39 barcodes through ASP.NET web form controller.
    • Intall ASP.NET barcode controller to your barcoding project by adding reference.
    • Add barcode library to your Visual Studio toolbox.
    • Open your unzipped trial package, and copy files "linear.aspx", "linear.aspx.cs" to the aspx page, in which you will be generating Code 39 images.
    • Now you can drag LinearASPNET to your ASP.NET web site, and change Code 39 settings through properties window on the right or use above free C# source code.
    • Debug and you will see the Code 39 barcode generated on your aspx pages.
How to Generate Code 39 Barcodes in Windows Applications in C# Generator?
  1. Add reference to BarcodeLib.Barcode.WinForms.dll to your barcoding project.
  2. Add BarcodeLib.Barcode.WinForms.dll to your Visual Studio Toolbox.
  3. Now please drag the LinearWinForm to your windows form or use above free C# source code, and a Code 39 barcode is generated.
C# Barcode Generator Control Supported Linear & 2D Barcodes
C# 1D Barcode Generation:
C# 2D Barcode Generation:
C# Barcode SDK Generates 1D (Linear) Barcodes: Codabar, Code 11, Code 2 of 5, Code 39, Code 93, EAN-8, EAN-13, Interleaved 2 of 5, ITF-14 (UPC Shipping Container Symbol), Code 128, EAN 128/GS1 128, MSI Plessey, Intelligent Mail, Planet, Postnet, RM4SCC (British Royal Mail), UPC-A, UPC-E.
C# Barcode SDK Generates 2D (Matrix) Barcodes: Data Matrix, PDF 417, QR Code.