How to create, print Code 128 in Crystal Reports in ASP.NET, WinForms application?

Create Code 128 Barcodes in Crystal Reports Projects Using .NET Control

Generate Code 128 linear barcode images for your Crystal Reports using .NET Barcode Library

  • Easy-to-use barcode generating SDK for Crystal Report
  • Compatible with Visual Studio 2022, 2019, 2016 and older versions
  • Support .NET Framework 4.x, 3.x, 2.x for ASP.NET, Windows Forms, WPF .NET projects
  • Can be used in any .NET languages such as C#, VB.NET, Managed C++, etc
  • Generate dynamic Code 128 in Crystal Report as list
  • Barcode generated completely conforms to international standard ISO/IEC 15417
  • Generate high quality Gif, Tiff, Bmp images or byte stream objects
  • Royalty free with purchase of developer license


How to create, print Code 128 barcode in Crystal Reports in Visual Studio project?

  1. Download Crystal Reports Code 128 Barcode Generator library
  2. Install Crystal Reports Barcode Generator dll file into Visual Studio .NET project
  3. Start to Create










Introduction of Code 128 Crystal Reports Barcode Generator

Top
Code 128 barcode generation component for Crystal Report is one function of our mature .NET barcode component, which is capable of generating high quality Code 128 as Graphic images and being exported to other file formats without image distortion.

Besides Code 128 Barcode Control for Crystal Reports, OnBarcode.com provides other linear and 2D barcode generator for Crystal Report with detailed online how-to guide:
  • Linear Barcodes in Crystal Reports: Code 39, Code 128, EAN-8, EAN-13, GS1 128, UPC-A, UPC-E, Interleaved 2 of 5, Identcode, ISBN, ISSN, ITF-14, Leitcode, MSI Plessey, OneCode, Planet, Postnet, RM4SCC, etc
  • 2D Barcodes in Crystal Reports : including QR Code , Data Matrix, PDF-417




How to Generate Code 128 in .NET Crystal Reports Barcode SDK

Top
This guide walks you through the process of generating Code 128 (a high-density linear barcode symbology) in Crystal Reports for .NET within ASP.NET and WinForms projects. It covers core implementation steps, character encoding, functional configurations, and dimension settings to ensure seamless integration with Crystal Reports components.


Preparation

We have two step by step tutorials to create new ASP.NET and Windows Forms .net framework projects to print barcodes in .rpt report file in .NET application.

After you have created a new ASP.NET or Windows Forms project with the first Code 128 barcode printed in the .rpt report, we will learn how to further customize Code 128 barcodes in Crystal Reports in the .NET application.




Code 128 Barcode Data Characters Encoding in Crystal Reports for .NET (C#)

Top

Code 128 Data Character Set

Code 128 barcode (supported in Crystal Reports for .NET) supports the following data characters:
  • All 128 Full ASCII characters defined in ISO/IEC 646.
  • Extended ASCII characters (values 128-255 of ISO/IEC 8859-1) via Function Character (FNC4).
  • 4 non-data function characters (FNC1-FNC4) for special operations.
  • 4 code set selection characters (for switching between Code Sets A/B/C).
  • 3 Start characters (one per code set) and 1 Stop character (mandatory for validation).




Code 128 Data Code Sets in C# for Crystal Reports

Code 128 barcode has three distinct code sets:
  • Code Set A: Includes uppercase letters, numbers, and control characters.
  • Code Set B: Includes lowercase letters, numbers, and standard symbols.
  • Code Set C: Optimized for numeric data (encodes two digits per character).

Key implementation notes for Crystal Reports:

The OnBarcode library auto-selects the optimal code set when BarcodeType.CODE128 is used (ideal for dynamic data in Crystal Reports Parameter fields). To manually specify a code set (for fixed data in Crystal Reports Group Header/ Footer), set the Type property to:
  • BarcodeType.CODE128A (Code Set A)
  • BarcodeType.CODE128B (Code Set B)
  • BarcodeType.CODE128C (Code Set C)




Code 128 Function Characters in C# for Crystal Reports

Function Characters (FNC) in Code 128 enable special behavior in Crystal Reports barcode rendering:
  • FNC1: Used for GS1 system compliance (e.g., GS1-128 in supply chain reports).
  • FNC2: Enables message append (useful for multi-part data in Crystal Reports Group Header).
  • FNC3: Instructs scanners to reprogram/initialize (rare in standard reports).
  • FNC4: Encodes extended ASCII characters (critical for non-English data in Crystal Reports).
Note: The barcode library auto-encodes FNC characters - do not manually input them into Crystal Reports Parameter/Formula fields or C# codes, as this will corrupt the barcode.




Code 128 Check Digit in C# for Crystal Reports

  • Code 128 requires a mandatory check digit (calculated via mod 103 algorithm).
  • The check digit is not visible in the human-readable interpretation (HRI) and is not returned by scanners.
  • In Crystal Reports integration: The AddCheckSum property of the Linear class is not applicable for Code 128 barcode - the library auto-calculates the check digit before the Stop character.




Code 128 Barcode Human Readable Interpretation (HRI) in Crystal Reports for .NET

Top
HRI (text below/above the barcode) is critical for readability in Crystal Reports. It must not violate the barcode's quiet zone (mandatory for scannability).

By default, the Code 128 library will print the HRI (Code 128 text label) below the Code 128 symbol

  • Set property TextMargin to customize the space between barcode and text label (HRI)
  • Set property TextFont to specify the text font name, style, and font size
  • Set property TextFont to customize the text color

barcode.TextMargin = 10;
barcode.TextFont = new Font("ocr-b", 22);
barcode.TextColor = Color.Blue;



Note: To render HRI above the barcode in Crystal Reports, set TextMargin to a negative value. Ensure the Crystal Report's Page Header/Details section has sufficient space to avoid overlapping with other report elements.




Code 128 Barcode Dimension Settings in Crystal Reports for .NET (C#)

Top
You can quickly customize the Code 128 image size in the report.
  • UOM: Unit of measure (PIXEL/CM/INCH, matches Crystal Reports report units).
  • Set the target Code 128 image width and height using property BarcodeWidth and BarcodeHeight
barcode.UOM = UnitOfMeasure.INCH;
barcode.BarcodeWidth = 1;
barcode.BarcodeHeight = 0.5f;


You can also further customize Code 128 dimensions to fit Crystal Reports layout (Page Header/Footer, Details section) using the following properties:
  • AutoResize: If true, the barcode library will choose the maximum bar module width and height values. If false, the barcode library will use the developer specified X value for bar module width, and Y value for bar module height.
  • X: Width of narrow elements (minimum width defined by application specs).
  • Y: Bar height (ensure it fits within Crystal Reports control bounds).
  • Margins (LeftMargin, RightMargin, TopMargin, BottomMargin): Quiet zone (minimum 10X to comply with barcode standards).












Common Asked Questions

What is the barcode Code 128 text code?

Code 128 barcode is a high-density 1d barcode symbology, which encodes digits, letters, control characters, and full ASCII 128 characters. Using Crystal Reports for .NET barcode generator library, you can create, print, insert Code 128 barcodes in Crystal report table cells, preview the Code 128 barcodes in Crystal report viewer in .NET ASP.NET Core, Windows Forms projects.

What is Code 128 barcode maximum length?

There is no specific definition about Code 128 barcode maximum number of characters in Code 128 ISO 15417 standard.

However some Code 128 standards will provide the limits. GS1-128 has limits the maximum length of Code 128 data to 48 characters.

Using .NET Crystal Reports Barcode library, you will encode and generate ISO standard Code 128 and application approved Code 128 barcodes, such as GS1-128 in Crystal reports in .NET web and Windows applications.

What is the check digit for code 128?

Code 128 barcode contains a last digit of mandatory check digit (checksum) character, which is based on module 103 (mod 103). Code 128 check digit will not be displayed in the Code 128 human readable text and will not be returned by the Code 128 barcode scanners. Using Crystal Reports for .NET barcode freeware, the generator software will automatically calculate the check character and insert into the Code 128 barcode in Visual Studio .NET Crystal reports ASP.NET Core, Windows Forms projects.

What is Code 128 barcode commonly used for?

Code 128 barcode is a common linear barcode type used in:
  • Food and non-food industries
  • Shipping and packing industry
  • Health, public sector and government bodies
Code 128 supports GS1 standards, which will be used in higher levels of packaging that are used in shipping and general distribution. You can easily create standard Code 128 barcodes in Crystal reports using Microsoft Visual Studio Crystal Report Designer extension.

Is Code 128 barcode better than Code 39?

Both Code 128 and Code 39 are popular 1d barcode symbologies. Code 128 is more compact than Code 39, supporting more data to be encoded in a smaller space. .NET Crystal Reports Barcode library allows C#/VB.NET developers to encoding and printing both Code 128 and Code 39 using Microsoft Visual Studio with the Crystal Report Designer extension.

How to scan, read Code 128 barcodes?

To scan, read and decode the Code 128 barcodes in the Crystal Reports, you can download and install OnBarcode free Code 128 barcode scanner software, or use barcode scanner device, or smart phone (iOS or Android) camera with 3rd party barcode apps installed.




































Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.