combit List & Label 24 - .NET Online Web Help
Error Handling with Exceptions
Programming Introduction > Other Important Concepts > 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. 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:

ListLabel LL = null;
try
{
  LL = new ListLabel();
  LL.DataSource = CreateDataSet();
  LL.Design();
}
catch (ListLabelException ex)
{
  MessageBox.Show(ex.Message);
}
finally
{
  if(LL != null)
    LL.Dispose();
}
Dim LL As ListLabel = Nothing
Try
  LL = New ListLabel
  LL.Design()
Catch ex As Exception
  MessageBox.Show(ex.Message)
Finally
  If (LL IsNot Nothing) Then
    LL.Dispose()
  End If
End Try