Using the Barcode Fonts with a Component Object Model (COM) Library

Component Object Model (COM) is an interface standard for implementing software components provided by Microsoft. It is programming language-neutral and can be used in different environments such as C# or VB or even across machines boundaries.

This tutorial illustrates the setup of the Barcode Fonts COM library provided in ConnectCode Barcode Fonts and then accessing the functions in the library through a Windows Forms application.


  • Visual Studio 2015
  • BarcodeFontsCOMLibrary.dll in the Resource\BarcodeFontsCOMLibrary subdirectory of ConnectCode Barcode Fonts.
  • BarcodeFormsCOMApplication.sln in the Resource\BarcodeFontsCOMLibrary\BarcodeFormsCOMApplication subdirectory.


1. Launch the Command Prompt (as Administrator) from the Windows Search bar (or Cortana Ask Me Anything).

2. In the Command Prompt, go to the following folder.

C:\Program Files (x86)\ConnectCode\Resource\BarcodeFontsCOMLibrary

3. The above folder contains the COM library “BarcodeFontsCOMLibrary.dll”

4. Enter the following command:

Regasm BarcodeFontsCOMLibrary.dll /tlb:BarcodeFontsCOMLibrary.tlb /codebase

Ensure that the command is executed successfully.

5. Launch Windows Explorer and navigate to the following folder:

C:\Program Files (x86)\ConnectCode\Resource\BarcodeFontsCOMLibrary

6. Copy the following “BarcodeFontsCOMApplication” folder to your Document folder or any other folder that you can remember.

7. Launch Visual Studio 2015 and open the solution in the BarcodeFontsCOMApplication folder.

8. Click on the Start button or Debug->Start Debugging menu item. This will start the Windows Forms application in the Visual Studio solution.

9. Click on the “Encode with COM” button as shown below and ensure that you see the following output in the text box.

The “í,BXnOî” characters when applied with the “ConnectCode128_S3.ttf” font will display an industry compliant Code 128 barcode.

10. Simply go back to Visual Studio, select the Textbox and change the font to “CCode128_S3” (or “CCode128_S3_Trial” if you are using the trial version of ConnectCode Barcode Fonts). Re-run the application and you will see the following:

11. The following display the C# programming codes to call the COM library.

     Type comObjectType =                    
     dynamic theComObject = 
          Activator.CreateInstance(comObjectType, false);

     //Guid myGuid = new 
     //        Guid("54A6DF68-D958-4D28-BDD4-8F26C367721F");
     //Type comObjectType = Type.GetTypeFromCLSID(myGuid);
     //dynamic theComObject 
     //        = Activator.CreateInstance(comObjectType, false);

     string inputData = "12345678";

     string result1 = theComObject.Encode_Code128Auto(inputData);
     string result = result1;
     textBox1.Text = result;
catch (Exception ex)

//COM Interface for reference

namespace ConnectCode

    public interface BarcodeFontsCOMLibraryInterface
        string Encode_Code128Auto(string inputData);

        string Encode_Code128A(string inputData);

        string Encode_Code128B(string inputData);

        string Encode_Code128C(string inputData);

        string Encode_Code39(string inputData,int checkDigit);

        string Encode_Code39ASCII(string inputData, int checkDigit);

        string Encode_Code93(string inputData, int checkDigit);

        string Encode_CodeCodabar(string inputData);

        string Encode_EAN13(string inputData,int humanReadableText);

        string Encode_EAN8(string inputData);

        string Encode_EXT2(string inputData);

        string Encode_EXT5(string inputData);

        string Encode_GS1Databar14(string inputData);

        string Encode_I2of5(string inputData,int checkDigit);

        string Encode_Industrial2of5(string inputData, int checkDigit);

        string Encode_ModifiedPlessy(string inputData, int checkDigit);

        string Encode_POSTNET(string inputData);

        string Encode_UCC(string inputData);

        string Encode_UPCA(string inputData, int humanReadableText);

        string Encode_UPCE(string inputData, int humanReadableText);

        //Optional Human Readable Text

        string Encode_Code128AutoHumanReadableText(string inputData);

        string Encode_Code128AHumanReadableText(string inputData);

        string Encode_Code128BHumanReadableText(string inputData);

        string Encode_Code128CHumanReadableText(string inputData);

        string Encode_Code39HumanReadableText(string inputData, int checkDigit);

        string Encode_Code39ASCIIHumanReadableText(string inputData, int checkDigit);

        string Encode_Code93HumanReadableText(string inputData, int checkDigit);

        string Encode_CodeCodabarHumanReadableText(string inputData);

        string Encode_EAN13HumanReadableText(string inputData, int humanReadableText);

        string Encode_EAN8HumanReadableText(string inputData);

        string Encode_EXT2HumanReadableText(string inputData);

        string Encode_EXT5HumanReadableText(string inputData);

        string Encode_GS1Databar14HumanReadableText(string inputData);

        string Encode_I2of5HumanReadableText(string inputData, int checkDigit);

        string Encode_Industrial2of5HumanReadableText(string inputData, int checkDigit);

        string Encode_ModifiedPlessyHumanReadableText(string inputData, int checkDigit);

        string Encode_POSTNETHumanReadableText(string inputData);

        string Encode_UCCHumanReadableText(string inputData);

        string Encode_UPCAHumanReadableText(string inputData, int humanReadableText);

        string Encode_UPCEHumanReadableText(string inputData, int humanReadableText);