How to make Code128 barcode image using Bytescout BarCode SDK for .NET

  • Home
  • /
  • Articles
  • /
  • How to make Code128 barcode image using Bytescout BarCode SDK for .NET

Output barcode screenshot (Code128 symbology)

Code128 bar code sample image

Code 128 barcode. It is a very effective, high-density symbology which permits the encoding of alphanumeric (subject to alphabet selection) data. Code 128 is a very dense code, used extensively worldwide.

Important: you can also use BarCode Windows Forms or Web ImageControl instead. To use the Windows Formscontrol in Visual Studio please open Toolbox and open “Bytescout Software” tab and drag-n-drop “BarCode” control into your WinForms or ASP.NET application (in design mode)

Visual Basic:

	<p><em>Imports Bytescout.BarCode</em></p>
	<p><em>Module Module1</em></p>
	<p><em>Sub Main()<br>
		' Create new barcode<br>
		Dim barcode As New Barcode()</em></p>
	<p><em>' Set <span data-scayt_word="symbology" data-scaytid="16">symbology</span><br>
		barcode.Symbology = SymbologyType.Code128<br>
		' Set value<br>
		barcode.Value = "DATA"</em></p>
	<p><em>' Save barcode to image<br>
		barcode.SaveImage("result.png")</em></p>
	<p><em>' Show image in default image viewer<br>
		Process.Start("result.png")<br>
		End Sub</em></p>
	<p><em>End Module</em></p>

C#:

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Bytescout.BarCode;

namespace Sample
{
class Program
{
static void Main(string[] args)
{
// Create new barcode
Barcode barcode = new Barcode();

// Set symbology
barcode.Symbology = SymbologyType.Code128;
// Set value
barcode.Value = “DATA”;

// Save barcode to image
barcode.SaveImage(“result.png”);

// Show image in default image viewer
Process.Start(“result.png”);
}
}
}

Demo how to generate Code 128 barcodes:


prev
next