Spread Silverlight Documentation
ValidationError Event (GcSpreadSheet)
Example 


Occurs when the cell value is invalid.
Syntax
'Declaration
 
Public Event ValidationError As System.EventHandler(Of ValidationErrorEventArgs)
'Usage
 
Dim instance As GcSpreadSheet
Dim handler As System.EventHandler(Of ValidationErrorEventArgs)
 
AddHandler instance.ValidationError, handler
public event System.EventHandler<ValidationErrorEventArgs> ValidationError
Event Data

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

PropertyDescription
ColumnGets the column index.  
RowGets the row index.  
ValidationResultGets or sets the policy that the user can set to determine how to process the error.  
ValidatorGets the validator which caused this error. This validator is a copy of the real validator, so any modifications to this validator do not take effect.  
Example
This example uses the ValidationError event. The event occurs if the typed data is less than three characters or greater than five.
gcSpreadSheet1.ActiveSheet[1, 1, 3, 3].DataValidator = GrapeCity.Windows.SpreadSheet.Data.DataValidator.CreateTextLengthValidator(GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator.Between, 3, 5);
private void gcSpreadSheet1_ValidationError(object sender, GrapeCity.Windows.SpreadSheet.UI.ValidationErrorEventArgs e)
        {
            listBox1.Items.Add(e.Column.ToString());
            listBox1.Items.Add(e.Row.ToString());
            listBox1.Items.Add(e.ValidationResult.ToString());
            listBox1.Items.Add(e.Validator.ToString());
            e.ValidationResult = GrapeCity.Windows.SpreadSheet.UI.UndoRedo.DataValidationResult.Discard;
        }

        private void gcSpreadSheet1_ValueChanged(object sender, GrapeCity.Windows.SpreadSheet.UI.CellEventArgs e)
        {
            listBox1.Items.Add(e.Column.ToString());
            listBox1.Items.Add(e.Row.ToString());
        }
GcSpreadSheet1.ActiveSheet(1, 1, 3, 3).DataValidator = GrapeCity.Windows.SpreadSheet.Data.DataValidator.CreateTextLengthValidator(GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator.Between, 3, 5)

Private Sub GcSpreadSheet1_ValidationError(sender As System.Object, e As GrapeCity.Windows.SpreadSheet.UI.ValidationErrorEventArgs) Handles GcSpreadSheet1.ValidationError
        ListBox1.Items.Add(e.Column.ToString())
        ListBox1.Items.Add(e.Row.ToString())
        ListBox1.Items.Add(e.ValidationResult.ToString())
        ListBox1.Items.Add(e.Validator.ToString())
        e.ValidationResult = GrapeCity.Windows.SpreadSheet.UI.UndoRedo.DataValidationResult.Discard
    End Sub

Private Sub GcSpreadSheet1_ValueChanged(sender As System.Object, e As GrapeCity.Windows.SpreadSheet.UI.CellEventArgs) Handles GcSpreadSheet1.ValueChanged
        ListBox1.Items.Add(e.Column.ToString())
        ListBox1.Items.Add(e.Row.ToString())
    End Sub
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

GcSpreadSheet Class
GcSpreadSheet Members

 

 


Copyright © GrapeCity, inc. All rights reserved.