.NET Code 128 barcode generator for c#, vb.net
How to generate barcode code 128 with checksum using c#, vb.net, no truetype font. With free C# example source code.


Complete free c#, vb.net example source code to generate, print barcode code 128 labels in asp.net mvc, windows, crystal reports.



  • Barcode DLL for software developers to generate Code 128 in own applications using C# & VB.NET
  • Strong-named assemblies written in C#.NET with full integration into .NET Framework
  • Print Code 128A, Code 128B & Code 128C barcodes in Visual C# & VB.NET class library
  • Generate Code 128 barcodes in Reporting Services, Crystal Reports & RDLC Reports
  • Automatically add checksum digit in Code 128 barcode image and display it in text
  • Draw and save Code 128 in Png, Jpeg/Jpg, Gif, Tiff, Bmp, etc. image formats
  • Professional Code 128 images with adjustable resolution to go with all printers
KA.Barcode Generator for .NET Suite Introduction
KA.Barcode Generator for .NET Suite is a mature and reliable barcode creator component which can easily add Code 128 and other 1D & 2D barcode generating features in .NET applications like ASP.NET web service, WinForms, Crystal Reports, SQL Server Reporting Services, C# & VB.NET class library. Flexible barcode settings with detailed tutorials are provied to help developers with easy barcode generation in .NET.

asp.net c# barcode reader, qr code generator c# source code, how to generate and print barcode in c# windows application, barcode scanner asp.net mvc, how to generate barcode in c# windows application, data matrix barcode reader c#
Code 128 Barcode Introduction
Code 128, also named 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, is a self-checking linear barcode which encodes 128 ISO/IEC 646 characters.
Code 128 Encodable Character Sets
  • Code 128 A (Code Set A): 0-9, A-Z, and special characters
  • Code 128 B (Code Set B): 0-9, A-Z, a-z, and special characters
  • Code 128 C (Code Set C): numeric digit pairs 00-99
  • Code 128Auto: KA provides Code 128Auto to encode all the above data types with automatic shifting between code sets
Download Code 128 Barcode Creator for .NET Suite
Users are allowed to download KA.Barcode for .NET Suite. After you unzip the evaluation version, you will find the following items: KeepAutomation.Barcode.Crystal.dll, KeepAutomation.Barcode.RDLC.dll, KeepAutomation.Barcode.SSRS2005.dll, KeepAutomation.Barcode.SSRS2005CRI.dll, KeepAutomation.Barcode.SSRS2008.dll, KeepAutomation.Barcode.SSRS2008CRI.dll, KeepAutomation.Barcode.Web.dll & KeepAutomation.Barcode.Windows.dll.
Generate Code 128 Barcode Using C# or VB.NET Class
To generate Code 128 barcode image using C# and VB.NET programming, you should add "KeepAutomation.Barcode.Windows.dll" or "KeepAutomation.Barcode.Web.dll" from the unzipped evaluation package and copy C# or VB sample code below.
C# Sample code
     BarCode code128 = new BarCode();
code128.Symbology = KeepAutomation.Barcode.Symbology.Code128Auto;
code128.CodeToEncode = "Code128";
code128.generateBarcodeToImageFile("c://code128-csharp.bmp");

VB Sample code
     Dim code128 As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

code128.Symbology = KeepAutomation.Barcode.Symbology.Code128Auto
code128.CodeToEncode = "Code128"
code128.generateBarcodeToImageFile("c:/code128-vbnet.bmp")

Generate Code 128 Barcode in ASP.NET Project
  1. Newly create your ASP.NET project and copy "barcode.aspx" and "barcode.aspx.cs" in "barcode" folder to your project folder.
  2. Locate "KeepAutomation.Barcode.Web.dll" to your project reference.
  3. Drag and drop "BarCodeControl" in Toolbox to the aspx page where your Code 128 barcode image is to be generated.
  4. In the Properties panel, choose Code128 barcode type.
  5. Debug to view your Code 128 barcode image.
Easy to generate Code 128 in Microsoft Internet Information Services (IIS)
  1. Find the "barcode" folder from the unzipped package and copy it to IIS web application folder.
  2. Create a new virtual directory named "barcode".
  3. Restart your IIS and navigate to "http://YourDomain:port/barcode/barcode.aspx?symbology=7&code-to-encode=Code128" (symboloy: Code128Auto=7, Code128A=8, Code128B=9, Code128C=10).
  4. Use the following image tag to insert barcodes in html or aspx pages:
    <img src="http://YourDomain:port/barcode/barcode.aspx?symbology=7&code-to-encode=Code128"(symboloy: Code128Auto=7, Code128A=8, Code128B=9, Code128C=10)/>
  5. Customize your created Code 128 barcode image in the above url.
Generate Code 128 Barcode in .NET WinForms
  1. Open your Visual Studio and create a new WinForms project.
  2. Add KeepAutomation.Barcode.Windows.dll to your Visual Studio Toolbox.
  3. Go to Toolbox, then drag and drop the BarCodeControl into the form.
  4. Set "Symbology" property to "Code128" in Properties window.
  5. You will see the created Code 128 barcode image.
Generate Code 128 Barcode in .NET Reports

Able to Create Standard Code 128 Barcode Image in Crystal Reports
Code 128 barcode image creation in Crystal Reports is quite easy with this barcode generation library.
Able to Create Standard Code 128 Barcode Image in RDLC Reports
Code 128 barcode image creation in RDLC Reports is quite easy with this barcode generation library.
Able to Create Standard Code 128 Barcode Image in Reporting Services
Code 128 barcode image creation in Reporting Services is quite easy with this barcode generation library.
Code 128 Property Settings
Class Attribute HTTP Attribute Default Value Note
Basic
Symbology symbology Code128Auto Barcode symoblogy type.

Valid values for Code 128 are:
  • KeepAutomation.Barcode.Symbology.Code128Auto

  • KeepAutomation.Barcode.Symbology.Code128A

  • KeepAutomation.Barcode.Symbology.Code128B

  • KeepAutomation.Barcode.Symbology.Code128C
CodeToEncode code-to-encode "128" Barcode value to encode.
  • Valid Data Scope for Code 128 Auto (KeepAutomation.Barcode.Symbology.Code128Auto):

    All 128 characters of ASCII (ASCII values from 0 to 127)

  • Valid Data Scope for Code 128 Set A (KeepAutomation.Barcode.Symbology.CODE128A):

    Supports ASCII values from 0 to 95

  • Valid Data Scope for Code 128 Set B (KeepAutomation.Barcode.Symbology.CODE128B):

    Supports ASCII values from 32 to 127

  • Valid Data Scope for Code 128 Set C (KeepAutomation.Barcode.Symbology.CODE128C):

    Supports pairs of digits
ChecksumEnabled checksum-enabled false This property is not applied here. Barcode SDK will always add a check character between encoded data and stop character (modulo 103).
ImageFormat image-format ImageFormat.Png Barcode encoded image format.
Barcode Size
AutoSizeAdjust auto-size-adjust false If true, barcode X, Y module will be auto-adjusted.
BarcodeUnit barcode-unit BarcodeUnit.Pixel Unit of measure for all size related settings. 0: pixel; 1: inch; 2: cm.
X x 1 Barcode module width (narrow bar).
Y y 50 Linear barcode bar height / 2D barcode module height.
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.
DPI dpi 72 Barcode image resolution in dpi.
Orientation orientation Orientation.Degree0 Barcode rotation angle.
BarCodeWidth barcode-width 0 Whole barcode width.
BarCodeHeight barcode-height 0 Whole barcode height.
Barcode Text Style
DisplayText display-text true Set to true, displaying barcode value text, otherwise do not display.
DisplayChecksum displace-checksum true Set to true, displaying barcode checksum digit, otherwise do not display.
TextFont text-font new Font(" Arial", 10 f, FontStyle.Regular) Barcode text font style.
TextMargin text-margin 6 Margin between barcode and text.
How to Generate Code 128 in .NET Applications with C#
In order for you to generate high-quality Code 128 barcodes in Class Library or Console Applications, we provide complete Visual C#.NET demo code here. All Code 128 parameters mentioned below can be adjusted as you like. Just make sure you have added this .NET barcode encoder dll to project reference initially.
C# Sample code

BarCode code128 = new BarCode();
code128.Symbology = KeepAutomation.Barcode.Symbology.Code128Auto;
code128.CodeToEncode = "Code128Csharp";

//Apply checksum for Code 128 barcode.
code128.ChecksumEnabled = true;

// Print Code 128 in specified image format like Png, Jpeg, Gif, Tiff, Bmp, etc.
code128.ImageFormat = ImageFormat.Png;

// Display checksum in the Code 128 human-readable text
code128.DisplayChecksum = true;

// Set Code 128 image size

// Code 128 unit of measure, Pixel, Cm and Inch supported.
code128.BarcodeUnit = BarcodeUnit.Pixel;
// Code 128 image resolution in DPI.
code128.DPI = 72;
// Code 128 bar module width (X dimention)
code128.X = 3;
// Code 128 bar module height (Y dimention)
code128.Y = 60;
// Image left margin size, a 10X is automatically added according to
code128.LeftMargin = 0;
// Image left margin size, a 10X is automatically added according to
code128.RightMargin = 0;
// Code 128 image top margin size
code128.TopMargin = 0;
// Code 128 image bottom margin size
code128.BottomMargin = 0;
// Code 128 image orientation, 0, 90, 180, 270 degrees supported.
code128.Orientation = KeepAutomation.Barcode.Orientation.Degree0;

// Set Code 128 human readable text

// Display human readable text
code128.DisplayText = true;
code128.TextFont = new Font("Arial", 10f, FontStyle.Regular);
// Space between barcode and text beneath.
code128.TextMargin = 6;

// Generate Code 128 barcodes in image format PNG
code128.generateBarcodeToImageFile("C://barcode-code128-csharp.png");

/* Create Code 128 barcodes in Stream object
code128.generateBarcodeToStream(".NET System.IO.Stream Object");

Draw & Print Code 128 barcodes to Graphics object
code128.generateBarcodeToGraphics(".NET System.Drawing.Graphics Object");

Generate Code 128 barcodes & write to byte[]
byte[] barcodeInBytes = code128.generateBarcodeToByteArray();

Generate Code 128 barcodes & encode to System.Drawing.Bitmap object
Bitmap barcodeInBitmap = code128.generateBarcodeToBitmap();
*/
Code 128 Barcode Generation Using VB.NET Demo Code
Users are allowed to copy the following free demo code to generate Code 128 barcode image in VB.NET application. To apply the demo code, users need to download our free evaluation version of this barcode control and add reference to your barcode project. It is able to change Code 128 parameters in order to get user-defined barcode image.
VB Sample code
     Dim code128 As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode
code128.Symbology = KeepAutomation.Barcode.Symbology.Code128Auto
code128.CodeToEncode = "0128"

'Apply checksum for Code 128 barcode.
code128.ChecksumEnabled = True
'Display checksum in the Code 128 barcode text
code128.DisplayChecksum = True

'Unit of measure, Pixel, Cm and Inch supported.
code128.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel
'Code 128 image resolution in DPI.
code128.DPI = 72

'Set Size for Generated Code 128 image

'Code 128 bar module width (X dimention)
code128.X = 2
'Code 128 barcode image width (X dimention)
code128.BarCodeWidth = 100
'Code 128 bar module height (Y dimention)
code128.Y = 60

'Image left margin size, a 10X is automatically added according to specification.
code128.LeftMargin = 0
'Image right margin size, a 10X is automatically added according to specification.
code128.RightMargin = 0
'Code 128 image top margin size'
code128.TopMargin = 0
'Code 128 image bottom margin size'
code128.BottomMargin = 0

'Orientation, 90, 180, 270 degrees supported' Code 128 image bottom margin size
code128.Orientation = KeepAutomation.Barcode.Orientation.Degree0
'Code 128 image formats in Png, Gif, Jpeg/Jpg, Tiff, Bmp/Bitmap, etc.
code128.ImageFormat = System.Drawing.Imaging.ImageFormat.Png

'Set Code 128 human readable text style

code128.DisplayText = True
code128.TextFont = New Drawing.Font("Arial", 10.0F, Drawing.FontStyle.Regular)
'Space between barcode and text
code128.TextMargin = 6

code128.generateBarcodeToImageFile("C://code128-vb-net.png")
Free Trial DownloadC#/VB Code 128For Web Code 128For Windows Code 128For Reports Code 128Using C#Using VB.NETData Matrix for .NETPDF417 for .NETQR Code for .NETmoreCodabar for .NETCode 39 for .NETEAN-8 for .NETEAN-13 for .NETEAN 128 for .NETIntelligent Mail for .NETInterleaved 2 of 5 for .NETISBN for .NETITF-14 for .NETRM4SCC for .NETUPC-A for .NETUPC-E for .NETmore
KeepAutomation provides complete barcode automation solutions. We recommend the customers use high quality document controls: ASP.NET Document Viewer, ASP.NET MVC Document Viewer, Document Viewer ASP.NET C#, ASP.NET PDF Viewer, ASP.NET Word Viewer, ASP.NET Excel Viewer, ASP.NET PDF Editor, MVC PDF Viewer, ASP.NET Annotate PDF, c# pdf sdk, C# View, edit PDF online , C# Convert PDF to Tiff, C# Convert PDF to text, txt, .net imaging sdk, C# PDF metadata edit from RasterEdge.com.