|
|
|
|
How to data binding custom objects to print barcode labels with Zebra ZPL-EPL
printers and VB.NET or C# by using ThermalLabel SDK for .NET
Prerequisites
- Neodynamic ThermalLabel SDK 2.0 for .NET
- Microsoft .NET Framework 2.0 (or greater)
- Microsoft Visual Studio 2005 / 2008
- Microsoft Visual Studio 2005 / 2008 Express Editions (VB, C#, J#, and C++)
- Any Zebra Thermal Printer supporting ZPL (Zebra Programming Language) or EPL (Eltron Programming Language)
ThermalLabel SDK supports .NET Data Binding scenarios allowing you to print thermal labels bound to a data source such as custom .NET objects, XML files, Databases, ADO.NET, etc.
In this guide you will learn how to perform data binding with .NET Custom Objects to print barcode labels with Zebra ZPL or EPL printers by using ThermalLabel SDK for .NET
The following sample features a class called Product with two basic properties: Id and Name. A list of Product and a ThermalLabel objects will be used to perform data binding scenario printing a set of thermal labels for each product as shown in the following figure.
 NOTE The following output is from a ZPL printer. Other printers based on different programming languages like EPL will produce different outputs.
IMPORTANT: To test the sample code you must have installed a Zebra ZPL-based or EPL-based thermal printer.
Follow these steps:
-
Download and install latest version of
Neodynamic ThermalLabel SDK for .NET
- Open Visual Studio 2005 / 2008 and create a Windows Forms application.
- Add a reference to Neodynamic.SDK.ThermalLabel.dll assembly.
- Add a Class file and name it Product. After that paste the following code into it:
Visual Basic .NET
Public Class Product
Dim _id As String
Dim _name As String
Public Sub New(ByVal id As String, ByVal name As String)
Me.Id = id
Me.Name = name
End Sub
Public Property Id() As String
Get
Return _id
End Get
Set(ByVal value As String)
_id = value
End Set
End Property
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
End Class
Visual C# .NET
public class Product
{
string _id;
string _name;
public Product(string id, string name)
{
this.Id = id;
this.Name = name;
}
public string Id
{
get { return _id; }
set { _id = value; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
}
- Add a button control onto the form and paste the following code in the click event handler of the button:
IMPORTANT NOTICE
Although ThermalLabel SDK supports both ZPL and EPL printers, a label design you write using .NET code like C# or VB.NET will not produce the same output printing under ZPL and EPL printers. If you need to support both printer languages in your project then you will have to design two different labels targeting each printer language separately.
- Run the sample Windows Forms application and test it.
If you need more information or assistance, please contact our
.
|
|
|
|