PowerTools MultiRow for Windows Forms 8.0J
Actions プロパティ
使用例 

検証が失敗したときに実行されるアクションを示すCellValidateActionのコレクションを取得します。
構文
Public ReadOnly Property Actions As ValidateActionCollection
public ValidateActionCollection Actions {get;}

プロパティ値

検証が失敗したときに実行されるアクションを示すValidateActionCollection値。
使用例
次のサンプルコードは、提供されているCellValidatorを使用して、異なる理由で各種CellValidateActionを実行する方法を示します。このサンプルコードは、CellValidatorクラスに示されている詳細なコード例の一部を抜粋したものです。
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
参照

CellValidator クラス
CellValidator メンバ
CellValidateAction クラス

 

 


© 2008-2015 GrapeCity inc. All rights reserved.