Spread Windows Forms 9.0 Product Documentation
Error Event
Example 


Occurs when the user performs an invalid operation.
Syntax
'Declaration
 
Public Event Error As ErrorEventHandler
'Usage
 
Dim instance As FpSpread
Dim handler As ErrorEventHandler
 
AddHandler instance.Error, handler
public event ErrorEventHandler Error
Event Data

The event handler receives an argument of type ErrorEventArgs containing data related to this event. The following ErrorEventArgs properties provide information specific to this event.

PropertyDescription
CancelGets or sets whether to cancel default processing and throw exceptions or the EditError event.  
ColumnGets the column index of the cell with the editor that raised the event.  
EditErrorGets the type of edit error.  
ErrorMessageGets the text description of the error.  
ExceptionGets the exception thrown by the error.  
IsEditErrorDetermines whether the error is an editing error.  
RowGets the row index of the cell with the editor that raised the event.  
ViewGets the view that contains the cell with the editor that raised the event.  
Remarks

This event is raised by the OnError method when the user leaves a cell.

For more details on the individual event arguments, refer to ErrorEventArgs members.

Example
This example raises the PaintTabStripButton event.
void FpSpread1_Error(object sender, ErrorEventArgs e)
{
      if ((e.EditError == FarPoint.Win.Spread.EditError.InvalidCellData))
      {
            if ((e.IsEditError == true))
            {
                  e.Cancel = true;
                  MessageBox.Show(e.ErrorMessage);
                  e.View.Sheets[0].Cells[e.Row, e.Column].BackColor = Color.Red;
            }
      }
}
Private Sub fpSpread1_Error(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.ErrorEventArgs) Handles fpSpread1.Error
      If e.EditError = Win.Spread.EditError.InvalidCellData Then
            If e.IsEditError = True Then
                  e.Cancel = True
                  MessageBox.Show(e.ErrorMessage)
                  e.View.Sheets(0).Cells(e.Row, e.Column).BackColor = Color.Red
            End If
      End If
End Sub
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

FpSpread Class
FpSpread Members
ErrorEventArgs Class

 

 


Copyright © GrapeCity, inc. All rights reserved.