VB.NET Code 128 Generator Data Encoding Tutorial

sample source code to input valid data and generate linear Code 128 images in VB.NET


 

Setup Code 128 VB.NET Generator

Code 128, also known as ANSI/AIM 128, ANSI/AIM Code 128, USS Code 128, Uniform Symbology Specification Code 128, is a very capable linear barcode of excellent density, high reliability.

OnBarcode.com also provides more details about how to set Code 128 barcode size and image in Barcode Generator Control on VB.NET:


Code 128 VB.NET Generator installation

1. Download the trial package and unzip

2. Copy OnBarcode.Barcode.WinForms.dll to your .NET project folder

3. Do not copy dll to .NET bin directory, .NET build tools will do it for you.

4. Add OnBarcode.Barcode.WinForms.dll to .NET project reference

5. Right click .NET Visual Studio Toolbox, select menu Choose Items...

6. In "Choose Toolbox Items" form, click button "Browse...", and select OnBarcode.Barcode.WinForms.dll

7. After selection, you will find four items under "Components" section: LinearWinForm, DataMatrixWinForm, PDF417WinForm, and QRCodeWinForm

After, get it ready in VB.NET by placing the following statement where Code 128 VB.NET Generator is needed:

Dim code128 As OnBarcode.Barcode.Linear

code128 = New OnBarcode.Barcode.Linear

code128.Type = OnBarcode.Barcode.BarcodeType.CODE128

 

Select Data for Code 128 VB.NET Generator

There are three code sets of Code 128. They are code set A, code set B, and code set C. Code 128 in different code set encodes different types of data character.

Generate Code 128 using Code Set A

Code 128 in code set A encodes 0-9, A-Z, control code, special characters, FNC1, FNC2, FNC3, and FNC4.

Sample Usage:

Dim code128 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear

code128.Type = OnBarcode.Barcode.BarcodeType.CODE128A

code128.Data = "1A"

Create Code 128 using Code Set B

Code 128 in code set B is to encode 0-9, A-Z, a-z, special characters, FNC1, FNC2, FNC3, and FNC4.

Sample Usage:

Dim code128 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear

code128.Type = OnBarcode.Barcode.BarcodeType.CODE128B

code128.Data = "1Aa"

Print Code 128 using Code Set C

Code 128 in code set C is only used for 00-99 and FNC1 encoding.

Sample Usage:

Dim code128 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear

code128.Type = OnBarcode.Barcode.BarcodeType.CODE128C

code128.Data = "10"

Make Code 128 using Auto Code Set

Code 128 VB.NET Generator build up a brand-new code set- code set auto, to make the Code 128 data encoding simpler.

Sample Usage:

Dim code128 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear

code128.Type = OnBarcode.Barcode.BarcodeType.CODE128

Using code set auto of Code 128 VB.NET Generator, the shifting between code sets could be done automatically.

 

Process Tilde in Code 128

If you want to use the tilde character "~" to specify special characters in the input data, please set property ProcessTilde to be true.

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

Sample Usage:

code128.ProcessTilde = True

 

Valid length for Data in Code 128 VB.NET Generator

Code 128 Data Length

Code 128 is variable length symbology, which easily encodes data at any length.

Data Length in Code 128 VB.NET Generator

The value of property Data, which is used to define the data in Code 128, is a string value. You can input data at any length in the string.

Sample Usage:

Dim code128 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear

code128.Type = OnBarcode.Barcode.BarcodeType.CODE128

code128.Data = "1"

Sample Usage:

Dim code128 As OnBarcode.Barcode.Linear = New OnBarcode.Barcode.Linear

code128.Type = OnBarcode.Barcode.BarcodeType.CODE128

code128.Data = "12345678"









OnBarcode is a market-leading provider of barcode generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides high quality tutorials and guides for various linear, 2d barcode information, such as C# Barcode, QR Code C#, QR Code VB.NET, QR Code ASP.NET, QR Code .NET, ASP.NET Barcode. OnBarcode barcode products are supported by RasterEdge ASP.NET Document Viewer, which supports ASP.NET PDF Viewer, ASP.NET MVC Document Viewer, ASP.NET PDF Editor, MVC PDF Viewer. And provide high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.