Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / FpSpread Class / CellValidateInfoNeeded Event
Example


In This Topic
    CellValidateInfoNeeded Event
    In This Topic
    Occurs when cell validate infomation is needed.
    Syntax
    'Declaration
     
    Public Event CellValidateInfoNeeded As EventHandler(Of CellValidateInfoNeededEventArgs)
    'Usage
     
    Dim instance As FpSpread
    Dim handler As EventHandler(Of CellValidateInfoNeededEventArgs)
     
    AddHandler instance.CellValidateInfoNeeded, handler
    public event EventHandler<CellValidateInfoNeededEventArgs> CellValidateInfoNeeded
    Event Data

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

    PropertyDescription
    Gets the cell validator.  
    Gets whether this validation is valid.  
    Gets the validate context.  
    Example
    This example uses the CellValidateInfoNeeded event.
    //Type a value equal to or less than 10 to see the red line
    FarPoint.Win.Spread.LineNotify linen = new FarPoint.Win.Spread.LineNotify();
    linen.LineColor = Color.Red;
    linen.DoActionReason = FarPoint.Win.Spread.ValidateReasons.EndEdit;
    FarPoint.Win.Spread.CompareCellValidator compare = new FarPoint.Win.Spread.CompareCellValidator();
    compare.ComparedOperator = FarPoint.Win.Spread.ValidateComparisonOperator.GreaterThan;
    compare.Row = 0;
    compare.Column = 0;
    compare.Actions.Add(linen);
    fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), compare);
    fpSpread1.Sheets[0].Cells[0, 0].Value = 10;
    
    private void fpSpread1_CellValidateInfoNeeded(object sender, FarPoint.Win.Spread.CellValidateInfoNeededEventArgs e)
      {
          listBox1.Items.Add(e.IsValid);
          listBox1.Items.Add(e.ValidateContext.ValidateReasons);
      }
    'Type a value equal to or less than 10 to see the red line
    Dim linen As New FarPoint.Win.Spread.LineNotify()
    linen.LineColor = Color.Red
    linen.DoActionReason = FarPoint.Win.Spread.ValidateReasons.EndEdit
    Dim compare As New FarPoint.Win.Spread.CompareCellValidator()
    compare.ComparedOperator = FarPoint.Win.Spread.ValidateComparisonOperator.GreaterThan
    compare.Row = 0
    compare.Column = 0
    compare.Actions.Add(linen)
    FpSpread1.Sheets(0).AddValidators(New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), compare)
    FpSpread1.Sheets(0).Cells(0, 0).Value = 10
    
    Private Sub FpSpread1_CellValidateInfoNeeded(sender As Object, e As FarPoint.Win.Spread.CellValidateInfoNeededEventArgs) Handles FpSpread1.CellValidateInfoNeeded
      ListBox1.Items.Add(e.IsValid)
      ListBox1.Items.Add(e.ValidateContext.ValidateReasons)
    End Sub
    See Also