GrapeCity MultiRow Windows Forms Documentation
Validation

You can use the Cell.Validate method to validate a cell's value. The Cell.Validate method returns False if there is a validation error in even one of the Cell.Validators. In addition, if you set the argument (doAction) of the Cell.Validate method to True, the Cell.Validators action is executed when the Cell.Validate method is called.

The GcMultiRow.CellValidating and GcMultiRow.CellValidated events do not occur, even if you call the Cell.Validate method.

Using Code

The following code uses the Cell.Validate method to validate all the cells.

[VB]

Imports GrapeCity.Win.MultiRow 
For Each r As Row In GcMultiRow1.Rows 
For Each c As Cell In r.Cells 
c.Validate(True) 
Next 
Next

[CS]

using GrapeCity.Win.MultiRow; 
foreach (Row r in gcMultiRow1.Rows) 
{ 
foreach (Cell c in r.Cells) 
{ 
c.Validate(true); 
} 
}

Validating the Value being Edited

If you set the argument of the Cell.Validate method to True, in the GcMultiRow.CellEditedFormattedValueChanged event, you can validate the value being edited.

Using Code

This example validates the value being edited.

[VB]

Imports GrapeCity.Win.MultiRow 
Private Sub GcMultiRow1_CellEditedFormattedValueChanged(sender As Object, e As CellEditedFormattedValueChangedEventArgs) Handles GcMultiRow1.CellEditedFormattedValueChanged 
Dim gcMultiRow As GcMultiRow = TryCast(sender, GcMultiRow) 
Dim currentCell As Cell = gcMultiRow.Rows(e.RowIndex).Cells(e.CellIndex) 
currentCell.Validate(True) 
End Sub

[CS]

using GrapeCity.Win.MultiRow; 
private void gcMultiRow1_CellEditedFormattedValueChanged(object sender, CellEditedFormattedValueChangedEventArgs e) 
{ 
GcMultiRow gcMultiRow = sender as GcMultiRow; 
Cell currentCell = gcMultiRow.Rows[e.RowIndex].Cells[e.CellIndex]; 
currentCell.Validate(true); 
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options