Error Handling With Exceptions

List & Label defines a number of internal exceptions, which are all derived from the common base class ListLabelException and therefore can be caught at a central location. If the application is supposed to carry out its own Exception handling, calls to List & Label can be enclosed by an Exception handler:

ListLabel LL = new ListLabel();
LL.DataSource = CreateDataSet();

 

try

{

    LL.Design();

}

catch (ListLabelException ex)

{

    MessageBox.Show(ex.Message);

}
LL.Dispose();

The Message property of the Exception class contains an error text, which – if a corresponding language kit is present – is also generally localized and can be displayed directly to the user.

A complete reference of all Exception classes can be found in the component help for .NET.