Microsoft Visual C# User Manual

NOTE: This page provides documentation for legacy code, included in the "Legacy" folder of the Developer Tools zip file. To obtain the latest documentation and code, refer to one of the following:

Legacy IDAutomation.cs Class Barcode Tutorial

Custom Barcode Windows Forms Control C# .NETThe C# IDAutomation.cs class file combines the encoding and printing of barcodes into one object. This class may be used as a template for C# barcoding needs. The class encodes data into the appropriate symbology format and sends the barcoded string to the default printer. The appropriate IDAutomation fonts must be installed before calling the print method of the class.

Note: Use of this C# Class, requires a Developer License or above. This font encoder is supplied with the purchase of a Developer's License or above of any Barcode Font Package.

  1. Included in the Developer Tool's folder of the purchased font package will be the IDAutomation C# barcode class file, which should be saved in the C# .NET project directory where the project lives.
  2. Open the Visual Studio C# .NET project.
  3. To use the printing features of the IDAutomation.com class, ensure that a reference to the System.Drawing namespace exists in the C# solution. To include the System.Drawing namespace
    • Click Project | Add Reference from the VS.NET IDE menu
    • On the .NET tab, locate and select the component name System.Drawing.dll
    • Click the Select button
    • Click the OK button
  4. Add the IDAutomation.cs file to the project
    • Click Project | Add Existing Item from the VS.NET IDE menu
    • Navigate to the location where you saved the downloaded IDAutomation.com class file
    • Select IDAutomation.cs from the list and click Open
  5. Include the IDAutomation_FontEncoder namespace to the solution. For example:
    using IDAutomation_FontEncoder;
  6. Once the reference to the IDAutomation_FontEncoder namespace is added to the C# solution, the bar code object may be instantiated, for example:
    clsBarCode IDAutomationBarcodeObject = new clsBarCode();
    where IDAutomationBarcodeObject is the name of the instance of this object. When finished using the object, it is recommended to destroy it to free memory. Example:
    IDAutomationBarcodeObject = null;
  7. Use the methods associated with the barcode object from the chart below. Methods in the class take a string as an input value, add the appropriate start and stop characters of the selected symbology, add the checksum character (if required by the symbology), and encode the data to the format of the symbology. The class also includes a print method that will take the encoded data, font type, and font size as input values and print the barcode to the default printer for the computer. The following table provides a detailed outline of each method.
Method Name Font to Use Purpose
Code128(DataToEncode) IDAutomationC128 The recommended and primary Code 128 method will automatically encode any data from ASCII 1 to ASCII 127. This method contains many options.
Code128a(DataToEncode) IDAutomationC128 Code 128 character set A.
Code128b(DataToEncode) IDAutomationC128 Code 128 character set B.
Code128c(DataToEncode) IDAutomationC128 Code 128 character set C.
Code128HR(DataToEncode) Text Font Returns the human-readable version of the data used in the Code128(DataToEncode) method.
Interleaved2of5(DataToEncode) IDAutomationI25
or
IDAutomationHI25
Formats the return string to the Interleaved 2 of 5 font.
Interleaved2of5Mod10(DataToEncode) IDAutomationI25
or
IDAutomationHI25
Performs the mod10 checksum calculation for increased accuracy and formats the return string to the Interleaved 2 of 5 font.
Code39(DataToEncode) IDAutomationC39
or
IDAutomationHC39
Formats the output to print using Code 39 fonts.
Code39mod43(DataToEncode) IDAutomationC39
or
IDAutomationHC39
Performs the mod43 checksum calculation for increased accuracy and then formats the output to print using Code 39 fonts. The mod43 checksum is usually required for LOGMARS and HIBC applications.
Codabar(DataToEncode) IDAutomationCB Formats the output to print using Codabar fonts.
EAN13(DataToEncode) IDAutomationUPCEAN Enter EAN-13 with or without a check digit, add-ons are supported. If a check digit is passed in it is ignored, recalculated, and added to the encoded output. Formats output to the UPC/EAN barcode font.
EAN8(DataToEncode) IDAutomationUPCEAN Formats output to the UPC/EAN barcode font. Enter exactly 7 characters (EAN-8 without the check digit).
MSI(DataToEncode) IDAutomationMSI Formats data to the MSI font.
POSTNet(DataToEncode) IDAutomationPOSTNET
or
IDAutomationPLANET
Enter a single string of Zip, Zip + 4, or Zip + 4 + Delivery Point. The input for this method must be a number and may include dashes and spaces.
PrintBarCode(FontName, DataToEncode, FontSize) na A print routine that combines the encoded data, the name of the font, and the font size as input parameters then sends the barcode to the default printer.
UPCA(DataToEncode) IDAutomationUPCEAN Enter UPC-A with or without a check digit, add-ons are supported. Formats output to the UPC/EAN barcode font.