Version

Handling Events

Before You Begin

The XamBarcode™ 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 XamBarcode 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 XamBarcode control to your page . For more info on this, see Adding Barcode Using XAML Code or Adding Barcode In Code-Behind .

  2. Handle the events :

In XAML:

<ig:XamMaxiCodeBarcode
        x:Name="Barcode"
        DataChanged="Barcode_DataChanged"
        ErrorMessageDisplaying="Barcode_ErrorMessageDisplaying" />

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 XAML:

<ig:XamPdf417Barcode
	x:Name="Barcode"
	Data="xamBarcode"
	EncodingMode="Numeric" />

In Visual Basic:

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

In C#:

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