This short guide explains how to set a barcode checksum using C#. It will explain the process through a set of instructions, introduce the resources required for the development, and demonstrate how to add a barcode 128 checksum using C#. Different types of barcodes will be identified where a checksum is applicable.
Steps to Checksum in Barcode using C#
- Configure the IDE to use Aspose.Barcode for .NET to set the checksum
- Import the necessary modules and classes
- Instantiate the license to avoid a watermark in the output
- Create the BarcodeGenerator object and set the EncodeTypes and text
- Disable the checksum and generate the barcode as PNG
- Enable the checksum and generate a barcode as PNG
These steps summarize how to apply the Code 128 checksum using C#. Import the required modules, set the license to avail full functionality, and instantiate the BarcodeGenerator object with the desired EncodeTypes value and text. Finally, set the IsChecksumEnabled to false and true for generating barcode PNG without and with a checksum.
Code to Set Barcode Checksum using C#
This sample code demonstrates how to work with a barcode checksum. Note that Code 128 cannot be generated without a checksum; therefore, you will get an exception if you try the code with EnableChecksum.No. Moreover, QR codes do not require this flag as the checksum is built into the QR code, and the EnableChecksum flag has no impact on the output.
This article has shared details for the barcode checksum. To change QR code color, refer to the article on Change QR Code Color using C#.