ConnectCode .Net DLL Integration

ConnectCode Barcode Fonts package includes a .Net 2.0/4.0 Dynamic Link Library (DLL) that you can bundle with your .Net application. This DLL helps you translate input data to barcode output characters, generate check digit and ensure that the data complies with industry specifications. The DLL can be redistributed with a Distribution or Unlimited Distribution License from ConnectCode.

The Resource\Net DLL Integration Samples directory of the installation package includes the .Net DLL and samples that demonstrate the use of the DLL.

Strong-Name .Net Barcode Dynamic Link Library (DLL)

ConnectCode Barcode Fonts package also provides a Strong-Name DLL signed using a cryptographic key pair. This allows the barcode DLL to be deployed to the Global Assembly Cache and you can enjoy all the benefits of a strong name DLL.

Location of the Strong-Name Barcode DLL

The Strong-Name DLL is stored in a subdirectory of the ConnectCode Barcode Fonts package.

       ...\Resource\Net DLL Integration Samples\DLL\StrongName

Integration Topics

Tutorial on using the .Net DLL

In this tutorial, we are going to create a Windows Forms Application that contains a TextBox that uses ConnectCode Barcode Fonts. The application will use the .Net DLL to verify the input and generate a check digit. The application will then set the appropriate fonts to generate the final barcode.

1. Launch Visual Studio 2005 (or VS2008/VS2010/VS2012/VS2015) to create a new project.

2. Goto File->New->Project. Select Visual C#->Windows Application. You can also choose to create a Visual Basic or Visual C++ application. The ConnectCodeBarcodeFonts.dll is .Net 2.0 (and onwards) compliant and can be used in any of the .Net languages project.

Name the project MyWindowsApplication.

3. Next, add a reference to the ConnectCode Barcode Fonts Library. The ConnectCodeBarcodeFonts.dll library can be found in the Resource\Net DLL Intergration Samples\DLL directory. This can be achieved by right clicking the References object in the Solution Explorer and selecting Add Reference.

4. The Add Reference Dialog will appear as below. Click on the Browse tab and navigate to the Resource\Net DLL Intergration Samples\DLL directory. Select ConnectCodeBarcodeFonts.dll and click ok.



5. The DLL is now ready to be used by the application. We will first add the namespace to the Form1.cs class. This can be carried out by right clicking on the Form1.cs class and selecting View Code. At the top of the Form1.cs class, you will see many "using System..." statements.

Add the statement

"using Net.ConnectCode.Barcode;"

In Visual Basic, you can add

"Imports Net.ConnectCode.Barcode"

6. We will next add the TextBox object to our application. Double click on Form1.cs in the Solution Explorer. Notice that Form1.cs [Design] tab will appear.

Click on the menu item View->Toolbox. In the Common Controls of the Toolbox, select the TextBox object. Next goto Form1 and drop the TextBox object.

Right click on TextBox and click on Properties. Set the Multiline property to True. Change the name of the TextBox to "textBoxOutput".

Next drop a button onto Form1. You Form1 should look like the following:



7. We will now make use of the ConnectCodeBarcodeFonts.dll in our application. Double click on the "button1" object in Form1. The following will appear in the source code editor.
private void button1_Click(object sender, EventArgs e)
{
}
8. Add the following code below

private void button1_Click(object sender, EventArgs e)
{
   //Add Code Start	
   BarcodeFonts barcode = new BarcodeFonts();
   barcode.BarcodeType = BarcodeFonts.BarcodeEnum.Code39;
   barcode.Data = "1234567";
   barcode.CheckDigit = BarcodeFonts.YesNoEnum.Yes;
   barcode.encode();
   textBoxOutput.Text = barcode.EncodedData;
   Font fontz = new Font("CCode39_S3_Trial", 24);
   textBoxOutput.Font = fontz;
   //Add Code End
}

9. Compile and run the application. You should see the following:



Note :

If you are compiling the projects in Vista, you may need to copy them into a folder that does not require elevated privilege for writing into.

Application Samples

The Resource\Net DLL Integration Samples\MyWindowsApplication directory contains the complete C# sample of the above tutorial.

Application Programming Interface

The following section illustrates how to generate the ConnectCode Barcode Fonts characters using the .Net DLL. Each of the attributes are explained below and the font to use for each barcode is shown in the following table.


BarcodeFonts barcode = new BarcodeFonts();
barcode.BarcodeType = BarcodeFonts.BarcodeEnum.Code39;
barcode.Data = "1234567";
barcode.CheckDigit = BarcodeFonts.YesNoEnum.Yes;

//Other Options	
//barcode.Extended = BarcodeFonts.YesNoEnum.Yes;
//barcode.EANStandards=BarcodeFonts.EANStandardsEnum.ISBN;

barcode.encode();
textBoxOutput.Text = barcode.EncodedData;

//Other output
//textBoxOutput.Text = barcode.HumanText;
//textBoxOutput.Text = barcode.EANText;

Font fontx = new Font("CCode39_S3_Trial", 24);
textBoxOutput.Font = fontx;

//Setting Fonts for Windows Phone or Windows 8
//textBoxOutput.FontFamily 
//  =new System.Windows.Media.FontFamily(fontFamily);



BarcodeType - Barcode symbology. The complete list of barcodes is listed in the table below.

Data - Input Data.

CheckDigit - Specifies whether you will like the check digit to be appended to the barcode.
Values : BarcodeFonts.YesNoEnum.Yes, BarcodeFonts.YesNoEnum.No

Extended - Specifies whether to use the extended style of the barcode. This option is only applicable to the EAN13, EAN8, UPCA and UPCE barcodes.
Values : BarcodeFonts.YesNoEnum.Yes, BarcodeFonts.YesNoEnum.No

EANStandards - This option is only used with the EAN13 barcode. It is used to specify whether the EANText will return the

ISBN - International Standard Book Number
ISBN13 - International Standard Book Number (Sunrise Compliance)
ISSN - International Standard Serial Number

Values :
BarcodeFonts.EANStandardsEnum.ISBN, BarcodeFonts.EANStandardsEnum.ISBN13, BarcodeFonts.EANStandardsEnum.ISSN, BarcodeFonts.EANStandardsEnum.None

HumanText - Returns the Human Readable Text of the barcode.

EANText - Returns the EAN text as specified in EANStandards.


Barcode API

 Barcode Fonts

Code128Auto

BarcodeType
BarcodeFonts.BarcodeEnum.Code128Auto

CheckDigit
Not applicable

CCode128_Sx

Code39

BarcodeType
BarcodeFonts.BarcodeEnum.Code39

CheckDigit
BarcodeFonts.YesNoEnum.Yes or BarcodeFonts.YesNoEnum.No

CCode39_Sx
POSTNET

BarcodeType
BarcodeFonts.BarcodeEnum.POSTNET

CheckDigit
Not applicable
CCodePostnet
Code93

BarcodeType
BarcodeFonts.BarcodeEnum.Code93

CheckDigit
BarcodeFonts.YesNoEnum.Yes or BarcodeFonts.YesNoEnum.No
CCode93_Sx
Codabar

BarcodeType
BarcodeFonts.BarcodeEnum.Codabar

CheckDigit
Not applicable
CCodeCodabar_Sx
Code39Ascii

BarcodeType
BarcodeFonts.BarcodeEnum.Code39Ascii

CheckDigit
BarcodeFonts.YesNoEnum.Yes or BarcodeFonts.YesNoEnum.No
CCode39_Sx
I2of5

BarcodeType
BarcodeFonts.BarcodeEnum.I2of5

CheckDigit
BarcodeFonts.YesNoEnum.Yes or BarcodeFonts.YesNoEnum.No
CCodeI2of5_Sx
ITF14

BarcodeType
BarcodeFonts.BarcodeEnum.ITF14

CheckDigit
BarcodeFonts.YesNoEnum.Yes or BarcodeFonts.YesNoEnum.No
CCodeITF_Sx
Industrial2of5

BarcodeType
BarcodeFonts.BarcodeEnum.Industrial2of5

CheckDigit
BarcodeFonts.YesNoEnum.Yes or BarcodeFonts.YesNoEnum.No
CCodeIND2of5_Sx
ModifiedPlessy

BarcodeType
BarcodeFonts.BarcodeEnum.ModifiedPlessy

CheckDigit
BarcodeFonts.YesNoEnum.Yes or BarcodeFonts.YesNoEnum.No
CCodeMSI_Sx
EAN13

BarcodeType
BarcodeFonts.BarcodeEnum.EAN13

CheckDigit
Not applicable

CCodeUPCEAN_Sx
CCodeUPCEAN_HRBSx CCodeUPCEAN_HRTSx

UPCA

BarcodeType
BarcodeFonts.BarcodeEnum.UPCA

CheckDigit
Not applicable

CCodeUPCEAN_Sx
CCodeUPCEAN_HRBSx CCodeUPCEAN_HRTSx

EAN8

BarcodeType
BarcodeFonts.BarcodeEnum.EAN8

CheckDigit
Not applicable

CCodeUPCEAN_Sx
CCodeUPCEAN_HRBSx
CCodeUPCEAN_HRTSx 

UCCEAN BarcodeType
BarcodeFonts.BarcodeEnum.UCCEAN

CheckDigit
Not applicable
CCode128_Sx
Code128A

BarcodeType
BarcodeFonts.BarcodeEnum.Code128A

CheckDigit
Not applicable
CCode128_Sx
Code128B

BarcodeType
BarcodeFonts.BarcodeEnum.Code128B

CheckDigit
Not applicable
CCode128_Sx
Code128C

BarcodeType
BarcodeFonts.BarcodeEnum.Code128C

CheckDigit
Not applicable
CCode128_Sx
UPCE

BarcodeType
BarcodeFonts.BarcodeEnum.UPCE

CheckDigit
Not applicable

CCodeUPCEAN_Sx
CCodeUPCEAN_HRBSx

EXT2

BarcodeType
BarcodeFonts.BarcodeEnum.EXT2

CheckDigit
Not applicable

CCodeUPCEAN_Sx
CCodeUPCEAN_HRTSx
CCodeUPCEAN_HRBSx

EXT5

BarcodeType
BarcodeFonts.BarcodeEnum.EXT5

CheckDigit
Not applicable

CCodeUPCEAN_Sx
CCodeUPCEAN_HRTSx
CCodeUPCEAN_HRBSx

GS1DataBar14

BarcodeType
BarcodeFonts.BarcodeEnum.GS1DataBar14

CheckDigit
Not applicable

CCodeGS1D_Sx

GS1DataBarLimited

BarcodeType
BarcodeFonts.BarcodeEnum.GS1DataBarLimited

CheckDigit
Not applicable

CCodeGS1D_Sx

GS1DataBarExpanded

BarcodeType
BarcodeFonts.BarcodeEnum.GS1DataBarExpanded

CheckDigit
Not applicable

CCodeGS1D_Sx

GS1DataBarTruncated

BarcodeType
BarcodeFonts.BarcodeEnum.GS1DatabarTruncated

CheckDigit
Not applicable

CCodeGS1DTR_S3

GS1DataBarStacked

BarcodeType
BarcodeFonts.BarcodeEnum.GS1DatabarStacked

CheckDigit
Not applicable

CCodeGS1DST

GS1DataBarStackedOmni

BarcodeType
BarcodeFonts.BarcodeEnum. GS1DataBarStackedOmni

CheckDigit
Not applicable

CCodeGS1DSTO

GS1DataBarExpandedStacked

BarcodeType
BarcodeFonts.BarcodeEnum. GS1DataBarExpandedStacked

CheckDigit
Not applicable

CCodeGS1DEST


Note :

The default font size for most barcodes is set to 24 (Except for POSTNET which is set to 9 and GS1 Databar Stacked Omni/GS1 Databar Expanded Stacked which is set to 48. But it can be adjusted to be slightly bigger or smaller. The font name needs to be appended with _Trial for Trial fonts.

If you are using the trial copy of ConnectCode Barcode fonts, the font name that is chosen when an input string is encoded will be appended with the word _Trial. As a consequence, the barcode sample that is displayed will be marked with horizontal lines at the top for some digits.