PowerTools MultiRow for Windows Forms 8.0J
Candidates プロパティ (IncludeListValidator)
使用例 

包含候補リストを示すSystem.Stringの配列を取得または設定します。
構文
Public Property Candidates As String()
public string[] Candidates {get; set;}

プロパティ値

包含候補リストを示すSystem.Stringの配列。既定値はnull 参照 (Visual Basicでは Nothing)です。
使用例
次のサンプルコードは、IncludeListValidatorを使用して、入力値が"null, 2, 3, 4, 5"のリストの中に含まれているかどうかを検証します。Cellに「1」と入力して別のセルに移動すると、検証が失敗したことを示すエラーアイコングリフがポップアップします。同じセルに「2」と入力して別のセルに移動した場合は、検証が成功し、エラーアイコングリフは表示されません。このサンプルコードは、CellValidatorに示されている詳細なコード例の一部を抜粋したものです。
void setIncludeListValidator_Click(object sender, EventArgs e)
{
    Template template = Template.CreateGridTemplate(1);

    IncludeListValidator includeListValidator = new IncludeListValidator();
    includeListValidator.Candidates = new string[] { null, "2", "3", "4", "5" };

    IconNotify iconNotify = new IconNotify();
    iconNotify.IconAlignment = ContentAlignment.MiddleCenter;
    iconNotify.IconTip = "The editing value is not within the specified candidate list!";
    //When CurrentCell move to another Cell, the action will be done.
    iconNotify.DoActionReason = ValidateReasons.CellValidating;

    includeListValidator.Actions.Add(iconNotify);

    template.Row.Cells[0].Validators.Add(includeListValidator);

    this.gcMultiRow1.Template = template;
    label.Text = "The IncludeListValidator.Candidates list is 'null,2,3,4,5', please input 1 in edit mode, then move CurrentCell to another Cell to trigger validation(DoActionReason is CellValidating), one error icon will pop up to notify you validation failed.";
}
Private Sub setIncludeListValidator_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setIncludeListValidator.Click
    Dim template As Template = template.CreateGridTemplate(1)

    Dim includeListValidator As New IncludeListValidator()
    includeListValidator.Candidates = New String() {Nothing, "2", "3", "4", "5"}

    Dim iconNotify As New IconNotify()
    iconNotify.IconAlignment = ContentAlignment.MiddleCenter
    iconNotify.IconTip = "The editing value is not within the specified candidate list!"
    'When CurrentCell move to another Cell, the action will be done.
    iconNotify.DoActionReason = ValidateReasons.CellValidating

    includeListValidator.Actions.Add(iconNotify)

    template.Row.Cells(0).Validators.Add(includeListValidator)

    Me.gcMultiRow1.Template = template
    label.Text = "The IncludeListValidator.Candidates list is 'null,2,3,4,5', please input 1 in edit mode, then move CurrentCell to another Cell to trigger validation(DoActionReason is CellValidating), one error icon will pop up to notify you validation failed."
End Sub
参照

IncludeListValidator クラス
IncludeListValidator メンバ

 

 


© 2008-2015 GrapeCity inc. All rights reserved.