Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / TextLengthValidator Class / LengthUnit Property

In This Topic
    LengthUnit Property
    In This Topic
    Gets or sets the LengthUnit used to validate the text length.
    Public Property LengthUnit As LengthUnit
    Dim instance As TextLengthValidator
    Dim value As LengthUnit
    instance.LengthUnit = value
    value = instance.LengthUnit
    public LengthUnit LengthUnit {get; set;}

    Property Value

    The length unit. The default is LengthUnit.Char.
    The assigned value is not a LengthUnit value.
    This example uses the text length validator.
    //Type a text string that contains more than 6 characters in cell 1,1 to see the error notification
    FarPoint.Win.Spread.CellStyleNotify cnotify = new FarPoint.Win.Spread.CellStyleNotify();
    cnotify.InvalidCellStyle.BackColor = Color.Aqua;
    FarPoint.Win.Spread.TextLengthValidator tvalid = new FarPoint.Win.Spread.TextLengthValidator();
    tvalid.LengthUnit = FarPoint.Win.Spread.LengthUnit.Char;
    tvalid.MaximumLength = 6;
    tvalid.MinimumLength = 0;
    tvalid.NullIsValid = true;
    fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), tvalid);
    'Type a text string that contains more than 6 characters in cell 1,1 to see the error notification
    Dim cnotify As New FarPoint.Win.Spread.CellStyleNotify()
    cnotify.InvalidCellStyle.BackColor = Color.Aqua
    Dim tvalid As New FarPoint.Win.Spread.TextLengthValidator()
    tvalid.LengthUnit = FarPoint.Win.Spread.LengthUnit.Char
    tvalid.MaximumLength = 6
    tvalid.MinimumLength = 0
    tvalid.NullIsValid = True
    FpSpread1.Sheets(0).AddValidators(New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), tvalid)
    See Also