Microsoft Visual C# User Manual
NOTE: This page provides documentation to 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
The 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. It is important that the appropriate IDAutomation fonts are 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 Purchase of Developer's License or above of any Barcode Font Package.
- 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.
- Open the Visual Studio C# .NET project.
- 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
- 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
- Include the IDAutomation_FontEncoder namespace to the solution.
- 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 for the instance of this object. When finished using the object, it is recommended to destroy it to free memory. Example:
IDAutomationBarcodeObject = null;
- 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 that 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.|
|Formats the return string to the Interleaved 2 of 5 font.|
|Performs the mod10 checksum calculation for increased accuracy and formats the return string to the Interleaved 2 of 5 font.|
|Formats the output to print using Code 39 fonts.|
|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.|
|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.|