.NET Barcode  >  .NET Barcode Generation Guide  >  .NET Barcode Code 128 Generator for .NET, C#, ASP.NET, VB.NET


.NET Barcode Code 128 Generator for .NET, C#, ASP.NET, VB.NET

.NET Barcode offers the most affordable .NET barcode generator for barcode .NET professionals.

.NET Code 128 Introduction

Code 128 is also known as ANSI/AIM 128, ANSI/AIM Code 128, USS Code 128, Uniform Symbology Specification Code 128, Code 128 Code Set A, Code 128 Code Set B, Code 128 Code Set C, Code 128A, Code 128B, Code 128C

Code 128 is a very effective, high-density symbology which permits the encoding of alphanumeric data. The symbology includes a checksum digit for verification, and the bar code may also be verified character-by-character verifying the parity of each data byte. This symbology has been widely implemented in many applications where a relatively large amount of data must be encoded in a relatively small amount of space. It's specific structure also allows numeric data to be encoded at, effectively, double-density.


How to generate Code-128 barcodes in C#.NET Class?

The following C# .NET code illustrates how to generate a Code-128 barcode in C# class:

using KeepDynamic.Barcode.Generator;

// Create linear barcode object in C#
BarCode barcode = new BarCode();

// Set barcode symbology type to Code-128 in C#
barcode.SymbologyType = SymbologyType.Code128;

// Set Code128 barcode value in C#
barcode.CodeText = "Code128";

// Set Code128 drawing image format to PNG in C#
barcode.Format = ImageFormat.Png;

// Generate Code-128 barcode & encode to the png image in C#
barcode.drawBarcode("C://barcode-code128-csharp.png");
  
// Generate Code-128 barcode & print to System.Drawing.Graphics object in C#
barcode.drawBarcode("Graphics object");
 
// Create Code-128 barcode & draw to System.IO.Stream object in C#
barcode.drawBarcode("Stream object");




How to generate Code-128 barcodes in VB.NET Class?

The following VB.NET code illustrates how to generate Code-128 barcodes in VB.NET class:

// Create linear barcode object in VB.NET
Dim barcode As KeepDynamic.Barcode.Generator.BarCode
barcode = New KeepDynamic.Barcode.Generator.BarCode()

// Set barcode symbology type to Code-128 in VB.NET
barcode.SymbologyType = SymbologyType.Code128;

// Set Code128 barcode value in VB.NET
barcode.CodeText = "Code128"

// Set Code128 drawing image format to PNG in VB.NET
barcode.Format = ImageFormat.Png

// Generate Code-128 barcode & encode to the png image in VB.NET
barcode.drawBarcode("C://barcode-code128-vbnet.png")
  
// Generate Code-128 barcode & print to System.Drawing.Graphics object in VB.NET
barcode.drawBarcode("Graphics object")
 
// Create Code-128 barcode & draw to System.IO.Stream object in VB.NET
barcode.drawBarcode("Stream object")


Creating Code-128 barcodes using .NET Barcode Generator Windows Form Control

To create Code-128 barcodes in Windows Forms applications, do the following procedures:

  • Add KeepDynamic.BarCode.Windows.dll to your C#, VB.NET project reference

  • Add KeepDynamic.BarCode.Windows.dll to windows project toolbox

  • Drag the BarCodeControl item to your windows forms


Creating Code-128 barcodes using ASP.NET Barcode Generator ASP.NET Web Form Control

To create Code-128 barcodes in ASP.NET Web Forms applications, do the following procedures:

  • Add KeepDynamic.BarCode.AspNet.dll to your C#, VB.NET project reference

  • Add KeepDynamic.BarCode.AspNet.dll to windows project toolbox

  • Drag the BarCodeControl item to your ASP.NET Web form pages, in your ASP.NET design view


.NET Code-128 Barcodes Properties

Class Properties HTTP Parameters Default Comments
SymbologyType symbology-type SymbologyType.Code128 Barcode type. Values for Code 128 are SymbologyType.Code128, SymbologyType.Code128a, SymbologyType.Code128b, SymbologyType.Code128c
CodeText code-text "" Barcode value to encode
EnableChecksum enable-checksum true Checksum for barcode value
GraphicsUnit graphics-unit GraphicsUnit.Pixel BarCode graphics meature for all size related settings. 0: pixel; 1: cm; 2: inch. Default is pixel
X x 2 Width of barcode module (narrow bar), default is 2 pixel
Y y 75 Barcode module height, default is 75 pixel
LeftMargin left-margin 0 Barcode image left margin
RightMargin right-margin 0 Barcode image right margin
TopMargin top-margin 0 Barcode image top margin
BottomMargin bottom-margin 0 Barcode image bottom margin
Resolution resolution 72 Barcode image resolution in dpi
Rotate rotate 0 Barcode rotate angle, valid values: 0, 90, 180, 270
DisplayCodeText display-code-text true If true, display barcode value text, otherwise do not display.
CodeTextFont code-text-font "Arial", Font.PLAIN, 11 Barcode text font style
Format format ImageFormat.Png Image format type. Using System.Drawing.Imaging.ImageFormat
ProcessTilde process-tilde false Set the ProcessTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is false.
~NNN: is used to represent the ASCII character with the value of NNN. NNN is from 000 - 255.
FNC1 fnc1 0 (none)
ApplicationIndicator ai 0





.NET Barcode Generator supports most common linear (1d) and matrix (2d) bar code standards, including:

2D Barcodes Code-39 related Code-128 related Code-25 related EAN/UPC related Other Linear Barcodes
Data Matrix

PDF-417

QR-Code

Code-39

Code-93

Code-128

GS1-128/UCC/EAN-128
Code 2 of 5

Interleaved 2 of 5

ITF-14

Identcode

Leitcode

EAN-8

EAN-13

ISBN

ISSN

UPC-A

UPC-E
Codabar

Code-11

POSTNET

PLANET

USPS Intelligent Mail Barcode (OneCode)

RM4SCC

MSI Plessey