KA.Barcode Generator for .NET Suite
How to Create & Resize Code 128 in VB.NET
Complete VB.NET source code to generate, print Code 128 images using Barcode Generator for .NET
  • Easily implement, integrate Code 128 generating control into VB.NET IDEs
  • Insert linear and GS1 barcodes , such as PDF417 Java, Word ISBN, .NET WinForms Interleaved 2 of 5, Intelligent Mail .NET, in your applications
  • Dynamically print and draw 1D Code 128 bar codes in VB.NET Web applications and Window projects
  • Drawing, creating Code 128 barcode and resize image with cm, inch, and pixel as the unit of measure
  • Barcoding Image Width and Image Height to generate 1D Code 128 with a fixed size
  • Support the width setting of surrounding margins for Code 128A/ B/ C creation & implementation
  • Generate, create Code 128 picture and save locally in image formats like Png, Gif, Jpeg, Tiff, or Bmp
  • Support to print 2D barcode in ASP.NET as well, including .NET Code 128, ITF-14 ASP.NET, Code 128 Java
  • Advanced algorithm to automatically calculate, add Code 128 checksum digit according to standard
  • High-quality Code 128 generation complying with ISO / IEC 15417 (2nd edition 2007-06-01)
VB.NET Code 128 barcode creator component API is one barcoding function of KA.Barcode for .NET Suite, which supports creating, drawing Code 128 and other linear, matrix barcodes into .NET, such as WinForms, ASP.NET web forms, Crystal Reports, and VB class & console applications. This document offers flexible sizing options for Code 128 in VB.NET. IIS; for other Code 128 related developer guides please link to:
Code 128 Barcode Structure
Code 128

Code 128 barcode (a.k.a ANSI/AIM 128, Uniform Symbology Specification Code 128, USS Code 128) is constructed of:
  • Left Quiet Zone
  • A start character
  • Message encoded
  • Check character
  • Stop Character
  • Termination bar (bar+space+bar)
  • Right Quiet Zone
Code 128 Size Setting in KA.Barcode Generator for .NET Suite

Code 128 Size Setting with VB.NET Class

  1. 1.
  2. 2.
    Copy KeepAutomation.Barcode.Windows.dll or KeepAutomation.Barcode.Web.dll to your VB.NET project folder
  3. 3.
    Open Microsoft Visual Studio, choose "Add Reference" in "Project"
  4. 4.
    Browse KeepAutomation.Barcode.Windows.dll or KeepAutomation.Barcode.Web.dll
  5. 5.
    Now you will see "KeepAutomation.Barcode.Web" or "KeepAutomation.Barcode.Windows" under your references
Copy those following VB.NET Code 128 barcoding samples onto you forms:
Dim barcode As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode
barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128Auto
barcode.CodeToEncode = "Code 128"
barcode.generateBarcodeToImageFile("C://barcode-code128-vbnet.gif")

Set Code 128 Barcode with BarcodeUnit Property

BarcodeUnit (URL: barcode-unit; Default: Pixel): it is the unit measurement for all size related settings in Code 128 barcodes. User may change it with "Pixel", "Inch" and "Cm". Replace sample code with following one:
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel

Set Code 128 with X and Y Property

X (URL: x; Default: 1): it is the width of the narrow bar in Code 128 barcodes

Y (URL: y; Default: 50): it is the height of bars in Code 128 barcodes.

Replace sample code with following one:
barcode.X = 3
barcode.Y = 75

Set Code 128 with BarCodeWidth and BarCodeHeight Property

BarCodeWidth (URL: barcode-width; Default: 0): it is the barcode width of Code 128 barcodes.

BarCodeHeight (URL: barcode-height; Default: 0): it is the barcode height of Code 128 barcodes.

Replace sample code with following one:
barcode.BarCodeWidth = 200
barcode.BarCodeHeight = 75

Set Code 128 with Quite Margin Property

TopMargin (URL: top-margin; Default: 0): it is the barcode image top margin in Code barcodes.

BottomMargin (URL: bottom-margin; Default: 0): it is the barcode image bottom margin in Code 128 barcodes.

LeftMargin (URL: left-margin; Default: 0): it is the barcode image left margin in Code 128 barcodes.

RightMargin (URL: right-margin; Default: 0): it is the barcode image right margin in Code 128 barcodes.

Replace sample code with following one:
barcode.TopMargin = 8
barcode.BottomMargin = 8
barcode.LeftMargin = 6
barcode.RightMargin = 6