GrapeCity.Win.MultiRow.v80 アセンブリ > GrapeCity.Win.MultiRow 名前空間 : RangeValidator クラス |
Public Class RangeValidator Inherits CellValidator Implements INamedObject
public class RangeValidator : CellValidator, INamedObject
このCellValidatorは、値がMinValueとMaxValueの間にあるかどうかを検証します。ただし、RequiredTypeプロパティによって、検証する値の型を指定する必要があります。
RequiredTypeが指定されていない場合、このCellValidatorは、所有元のCellのCell.ValueTypeまたはCell.FormattedValueType(ValueTypeがnull 参照 (Visual Basicでは Nothing)の場合)を必要な型として使用します。
RequiredTypeを新しい値に設定すると、MinValueとMaxValueがnull 参照 (Visual Basicでは Nothing)に設定されます。
このCellValidatorを使用する際は、検証する値、MinValue、およびMaxValueがSystem.IComparable値であることを確認してください。
void setRangeValidator_Click(object sender, EventArgs e) { Template template = Template.CreateGridTemplate(1); //Create one RangeValidator to vaidate whether the committed value is between one range. RangeValidator rangValidator = new RangeValidator(); //You should set the RequiredType first, then set other Properties. rangValidator.RequiredType = typeof(int); rangValidator.MinValue = 5; rangValidator.MaxValue = 10; rangValidator.NullIsValid = false; LineNotify lineNotifyAction = new LineNotify(); //When you ends edit mode, the action will be done.(press Enter key commonly) lineNotifyAction.DoActionReason = ValidateReasons.EndEdit; lineNotifyAction.LineColor = Color.Red; rangValidator.Actions.Add(lineNotifyAction); template.Row.Cells[0].Validators.Add(rangValidator); this.gcMultiRow1.Template = template; label.Text = "The RangeValidator's MinValue is 5, MaxValue is 10, input 4(not between the range) in one Cell, press Enter key to trigger validation(DoActionReason is EndEdit), one red under line will be shown."; }
Private Sub setRangeValidator_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setRangeValidator.Click Dim template As Template = template.CreateGridTemplate(1) 'Create one RangeValidator to vaidate whether the committed value is between one range. Dim rangValidator As New RangeValidator() 'You should set the RequiredType first, then set other Properties. rangValidator.RequiredType = GetType(Integer) rangValidator.MinValue = 5 rangValidator.MaxValue = 10 rangValidator.NullIsValid = False Dim lineNotifyAction As New LineNotify() 'When you ends edit mode, the action will be done.(press Enter key commonly) lineNotifyAction.DoActionReason = ValidateReasons.EndEdit lineNotifyAction.LineColor = Color.Red rangValidator.Actions.Add(lineNotifyAction) template.Row.Cells(0).Validators.Add(rangValidator) Me.gcMultiRow1.Template = template label.Text = "The RangeValidator's MinValue is 5, MaxValue is 10, input 4(not between the range) in one Cell, press Enter key to trigger validation(DoActionReason is EndEdit), one red under line will be shown." End Sub
System.Object
GrapeCity.Win.MultiRow.CellValidator
GrapeCity.Win.MultiRow.RangeValidator