Home  >  .NET Barcode Generator Suite  >  .NET Barcode Generation Guide  >  Code 39 Barcode Generator Library for VB.NET, C#, ASP.NET & WinForms
.NET Code 39 Barcode Generator for C#, ASP.NET, VB.NET
.NET Code 39 Barcode Generator integrates Code 39 barcode generating feature into .NET developing environments, like ASP.NET web application & Windows Forms project. This Code 39 barcode generating dll supports creating Code 39 barcode in .NET classes using C# or VB.NET class codes.
.NET Code 39 Barcode Introduction
Code 39 is also known as ANSI/AIM Code 39, ANSI/AIM Code 39, Uniform Symbology Specification Code 39, USS Code 39, USS 39, Code 3/9, Code 3 of 9, USD-3, LOGMARS, Alpha39, Code 39 Extended, and Code 39 Full ASCII.
Code 39, the first alpha-numeric symbology to be developed, is still widely used-especially 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).
Use .NET Windows Forms Barcode Generating Control to Create Code 39 Barcode Images
  1. Integrate KeepDynamic.BarCode.Windows.dll to your Windows Forms project by adding reference
  2. Integrate KeepDynamic.BarCode.Windows.dll to Visual Studio toolbox by choosing item
  3. Drag & drop BarCodeControl item from the toolbox to your windows forms project and a default Code 128 barcode image will be generated
  4. Select created barcode images, change its change the value of SymbologyType to Code39 and adjust the value of CodeText to Code 39 barcode encodable characters in the Properties window
  5. Run the .NET Windows Forms project and view generated Code 39 barcode image
Use .NET ASP.NET Web Barcode Generating Control to Create Code 39 Barcode Images
  1. Add KeepDynamic.BarCode.AspNet.dll to your ASP.NET web class and Visual Studio toolbox respectively
  2. Copy "linear.aspx", "linear.aspx.cs" from folder barcode(which is located in the folder Documentation) to your ASP.NET project
  3. Drag the BarCodeControl item from VS toolbox to your ASP.NET Web form pages and a barcode image will be generated (KeepDynamic.com sets Code 128 barcode as the defaul barcode image)
  4. Click created barcode image and change its change the value of SymbologyType to Code39 and adjust the value of CodeText to Code 39 barcode encodable characters in the Properties window
  5. Run the ASP.NET web project and a standard Code 39 barcode images will be generated
Use C#.NET Class Code to Generate Code 39 Barcode Images in .NET Applications
// generate linear barcode object 
BarCode barcode = new BarCode();

// Set barcode type to Code-39
barcode.SymbologyType = SymbologyType.Code39;

// Enter encodable value to Code39 barcode
barcode.CodeText = "CODE39";

//Display Code 39 start / stop character
barcode.DisplayStartStopChar = true;

// Add checksum character to Code 39
barcode.EnableChecksum = true;

// set wide & narrow bar width ratio
barcode.WideNarrowRatio = 3;

// set Code 39 barcode image settings
// Set bar width of Code 39
barcode.X = 3;

// set Code 39 barcode image
barcode.BarCodeWidth = 500;
barcode.BarCodeHeight = 90;

// Set Code39 drawing image format to PNG
barcode.Format = System.Drawing.Imaging.ImageFormat.Png;

// save generated barcode images to png image file using C#
barcode.drawBarcode("C://kdcode39.png");
More C# class code for .NET Code 39 barcode generation
Use VB.NET Class Code to Generate Code 39 Barcode Images in .NET Applications
' generate linear barcode object 
Dim barcode As New BarCode()

' Set barcode type to Code-39
barcode.SymbologyType = SymbologyType.Code39

' Enter encodable value to Code39 barcode
barcode.CodeText = "CODE39"

'Display Code 39 start / stop character
barcode.DisplayStartStopChar = True

' Add checksum character to Code 39
barcode.EnableChecksum = True

' set wide & narrow bar width ratio
barcode.WideNarrowRatio = 3

' set Code 39 barcode image settings
' Set bar width of Code 39
barcode.X = 3

' set Code 39 barcode image
barcode.BarCodeWidth = 500
barcode.BarCodeHeight = 90

' Set Code39 drawing image format to PNG
barcode.Format = System.Drawing.Imaging.ImageFormat.Png

' save generated barcode images to png image file using VB.NET
barcode.drawBarcode("C://kdcode39.png")
More VB.NET class code for .NET Code 39 barcode generation
.NET Code-39 Barcodes Properties

Barcode properties HTTP Parameters Default Comments
Code 39 specific properties SymbologyType symbology-type Code128 Type of barcode symbology

Change the barcode type to Code 39 using the value: SymbologyType.Code39 (4); SymbologyType.Code39ex (5)
CodeText code-text "1234567890" The charaters to encode into a barcode symbology

Valid data character set of Code 39 consist of:

  • Numeric digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • Captital letters: A - Z
  • Symbols: (-), (.), ($), (/), (+), (%), and space

Valid data character set of Code 39 extension contain

  • All 128 characters in ASCII
DisplayStartStopChar display-start-stop-char True The start and stop characters used for marking the beginning and ending of a symbology

Code 39 Start/Stop characters: (*)

Within Code 39, the start and stop characters are necessary and display automatically in the data string of the barcode.
WideNarrowRatio wide-narrow-ratio 2.0 The wide to narrow width ratio.

This is a property of the barcodes such as Codabar, Code 2of5, Interleaved 2 of 5, ITF-14, Identcode, Leitcode that only contains wide bars and narrow bars

Valid Codabar Wide/Narrow ratio ranges from 2.0 to 3.0
EnableChecksum enable-checksum True Code 39 uses an optional modulo 43 check digit.

The default value enables the check digit to Code 39
Symbology properties X x 2 The width of narrow bars and the default value of X is 2 pixels.

You can increase the value of X to enhance the readability of the barcode if the barcode scanners could not read stably the barcode which is set as the default value in X dimension.
Y y 75 Height of a barcode module

The default bar height value is 75 pixels
Resolution resolution 72 This property set the resolution in DPI of a barcode image to be drawn, and the default value that is set to printer is 72 pixels. You can adjust the value to get a custom resolution barcode image.
GraphicsUnit graphics-unit GraphicsUnit.Pixel This is the barcode graphic measurements for all size related settings. 0: pixel; 1: cm; 2: inch. The default value is pixel
Rotate rotate 0 The Rotate property allows you changing the angle of a barcode. The valid values are Rotate0, Rotate 90, Rotate 180, and Rotate 270
DisplayCodeText display-code-text true The default value is true, which makes the encoded data message human readable. Otherwise the data message text will not be displayed on the barcode image
CodeTextFont code-text-font "Arial", Font.PLAIN, 11 CodeTextFont property is used for changing the font style of data message text that can be read by human eyes.
Image properties Format format ImageFormat.Png This is a method that is used for exporting barcode to different type of image formats. It allows developers generate barcode in formats like JPEG/JPG, BMP, GIF, and PNG.

The default method is ImageFormat.Png. Image format type. Using System.Drawing.Imaging.ImageFormat
LeftMargin left-margin 0 The property to set the distance between the symbol and the left margin of a barcode image.
RightMargin right-margin 0 The property to set the distance between the symbol and the right margin of a barcode image.
TopMargin top-margin 0 The property to customize the space between the symbol and the top margin on a barcode image
BottomMargin bottom-margin 0 The property to change the space between the symbol and the bottom margin on a barcode image

Use .NET Code 39 Barcode Control to Generate other Barcode Types