Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / FocusProcess Class / PreventFocusLeave Property

In This Topic
    PreventFocusLeave Property
    In This Topic
    Gets or sets whether to keep the focus on the validating Cell.
    Public Property PreventFocusLeave As Boolean
    Dim instance As FocusProcess
    Dim value As Boolean
    instance.PreventFocusLeave = value
    value = instance.PreventFocusLeave
    public bool PreventFocusLeave {get; set;}

    Property Value

    true to keep the focus on the validating Cell; otherwise, false. The default is true.
    This example keeps focus in the cell if the value is invalid.
    //Typing a value outside the range prevents focus from leaving the cell
    FarPoint.Win.Spread.FocusProcess cnotify = new FarPoint.Win.Spread.FocusProcess();
    cnotify.PreventFocusLeave = true;
    FarPoint.Win.Spread.TextLengthValidator tvalid = new FarPoint.Win.Spread.TextLengthValidator();
    tvalid.LengthUnit = FarPoint.Win.Spread.LengthUnit.Char;
    tvalid.MaximumLength = 6;
    tvalid.MinimumLength = 0;
    fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), tvalid);
    'Typing a value outside the range prevents focus from leaving the cell
    Dim cnotify As New FarPoint.Win.Spread.FocusProcess()
    cnotify.PreventFocusLeave = True
    Dim tvalid As New FarPoint.Win.Spread.TextLengthValidator()
    tvalid.LengthUnit = FarPoint.Win.Spread.LengthUnit.Char
    tvalid.MaximumLength = 6
    tvalid.MinimumLength = 0
    FpSpread1.Sheets(0).AddValidators(New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), tvalid)
    See Also