Version

Handling Events

Before You Begin

The UltraBarcode™ control exposes the following events:

The ErrorMessageDisplayingEventArgs object’s ErrorMessage property allows you to get or set the error message. The DataChangedEventArgs object’s NewData property conveniently allows you to get the value of the UltraBarcode control’s Data property that has just been changed.

What You Will Accomplish

You will handle the DataChanged and ErrorMessageDisplaying events .

Follow these Steps

  1. Add a UltraBarcode control to your form. For more info on this, see Adding Barcode In Code-Behind .

  2. Handle the event:

In Visual Basic:

Import Infragistics.Controls.Barcodes

Private Sub Barcode_DataChanged (ByVal sender As System.Object,
    ByVal e As DataChangedEventArgs)
        Dim errorMessage = e.ErrorMessage
End Sub

Private Sub Barcode_ErrorMessageDisplaying (ByVal sender As System.Object, ByVal e As ErrorMessageDisplayingEventArgs)
    Dim newData = e.NewData
End Sub

In C#:

using Infragistics.Controls.Barcodes;

private void Barcode_ErrorMessageDisplaying(object sender,
  ErrorMessageDisplayingEventsArgs e) {
    string errorMessage = e.ErrorMessage;
}

private void Barcode_DataChanged(object, DataChangedEventArgs e) {
    string newData = e.NewData;
}
  1. Save and run your application.

Default Error Message

In Visual Basic:

Dim Barcode As New UltraPdf417Barcode()
Barcode.Data = "xamBarcode"
Barcode.EncodingMode = CompactionMode.Numeric

In C#:

var Barcode = new UltraPdf417Barcode();
Barcode.Data = "xamBarcode";
Barcode.EncodingMode = CompactionMode.Numeric;
barcode dataError.png