How to Encode Code 128 Data in .NET WinForms
BusinessRefinery.com Winforms Code 128 Barcode Generator is an Winforms barcode generation control that enables .NET developers to create, manage and manipulate Code 128 barcodes in Windows forms applications and .NET class.
Absolutely, this products I generates Code 128 barcodes compatible with its barcode specification in ISO - ISO / IEC 15417 (2nd edition 2007-06-01). This article explains how to encode Code 128 valid characters in Winforms; other Code 128 barcode related setting, please see:
Code 128 Data Related Properties
Symbology
With Barcode Generator for Winforms, users are allowed to encrypt Code 128 barcode encodable character sets using
Symbology property.
Winforms Code 128 Barcode encodes:
- Code128Auto: encodes all encodable characters of Code 128
- Code128A: encodes all of the standard upper case alphanumeric characters and punctuation characters together with the control characters
- Code128B: all of the standard upper case alphanumeric characters and punctuation characters together with the lower case alphabetic characters
- Code128C: the set of 100 digit pairs from 00 to 99 inclusive, as well as three special characters
Code
With Barcode Generator for Winforms, users are allowed to control Code 128 barcode data length using Code property.
ProcessTilde
With Barcode Generator for Winforms, users are allowed to encode some special characters for Code 128 barcode using a tilde characters "~" using
ProcessTilde property.
- 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255); ASCII character '~' is presented by ~126
Strings from "~256" to "~299" are unused - 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
Strings from "~665536" to "~699999" are unused
Human-readable Text
With Barcode Generator for Winforms, users are allowed to show human-readable text with customized text style under generated Code 128 symbols DisplayText and Textfont properties.
Customize Code 128 Barcode Data in Winforms
Ensure have installed those programs before you encrypt Code 128 valid data in .NET Winforms:
- Microsoft .NET Framework 2.0/3.0/4.0
- Microsoft Visual Studio 2005/2008/2010 (Express, Professional & Standard Edition)
- Barcode Generator for Winforms installed
Customize Code128 Barcode Images in Windows Forms Using BarcodeControl
- Add .NET Winforms Barcode Control onto your .NET Visual Studio Toolbox;
- Drag and drop the WinLinearBarcode control into the Forms;
- You will see a barcode image generated;
- Right click you mouse to activate barcode setting panel and choose Symbology to CODE128;
- Select Symbology, Code, ProcessTilde,AddChecksum, DisplayChecksumDigit, DisplayText and Textfont respectively to customize your Code 128 barcodes.
Encode Code 128 Barcode Data in Winforms Using C#, VB.NET Class
using BusinessRefinery.Barcode;
Linear barcode = new Linear();
barcode.Symbology = Symbology.CODE128;
// Encode Code 128 barcode with tilde charcater "~"
barcode.ProcessTilde= true;
barcode.Code = "~648918";
// Display Code 128 barcode human-readable text with customized font
style
barcode.DisplayText = true;
barcode.TextFont = new Font("Arial", 11.0f, FontStyle.Bold);
barcode.drawBarcode2ImageFile("c:/code-128-csharp.gif");
Dim barcode As BusinessRefinery.Barcode.Linear =
New BusinessRefinery.Barcode.Linear()
' Encode Code 128 barcode with Subset C
barcode.Symbology = BusinessRefinery.Barcode.Symbology.CODE128C
' Encode Code 128 barcode with multiple length
barcode.Code = "648918"
' Display Code 128 barcode human-readable text with customized font
style
barcode.DisplayText = true
barcode.TextFont = new Font("Arial", 11.0f, FontStyle.Bold)
barcode.drawBarcode2ImageFile("c:/code-128-vb-net.gif")