PowerTools InputMan for Windows Forms 8.0J
GetValidateItems メソッド (GcCommonValidator)
使用例 

コントロールを表すControlオブジェクト。
コントロールに関連付けられた検証アイテムのコレクションを取得します。
構文
Public Overrides Function GetValidateItems( _
   ByVal control As Control _
) As Validator(Of Control)
public override Validator<Control> GetValidateItems( 
   Control control
)

パラメータ

control
コントロールを表すControlオブジェクト。
使用例
検証アイテムと検証アクションを設定した GcCommonValidator コンポーネントを作成するコード例を次に示します。この例では他に GetValidateItems と Validator<T>.GetValidateActions メソッドを使用しています。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;

public void SetGcCommonValidatorSettings()
{
    // Creates an instance of a GcTextBox control.
    GcTextBox gcTextBox1 = new GcTextBox();
    // Creates an instance of a GcCommonValidator component.
    GcCommonValidator gcCommonValidator1 = new GcCommonValidator();
    // Creates a FocusProcess object.
    FocusProcess focusProcess1 = new FocusProcess();
    focusProcess1.PreventFocusLeave = true;
    // Creates an InvalidPairChar object.
    InvalidPairChar invalidPairChar1 = new InvalidPairChar();
    PairChar pairChar1 = new PairChar();
    PairChar pairChar2 = new PairChar();
    PairChar pairChar3 = new PairChar();
    PairChar pairChar4 = new PairChar();
    pairChar1.Left = '[';
    pairChar1.Right = ']';
    pairChar2.Left = '{';
    pairChar2.Right = '}';
    pairChar3.Left = '(';
    pairChar3.Right = ')';
    pairChar4.Left = '「';
    pairChar4.Right = '」';
    invalidPairChar1.PairChars.AddRange(new PairChar[] {pairChar1,pairChar2,pairChar3,pairChar4});

    // Gets the ValidateActions defined for the gcTextBox, and adds the FocusProcess object to the collection.
    gcCommonValidator1.GetValidateActions(gcTextBox1).AddRange(new ValidateAction[] { focusProcess1 });
    // Gets the ValidateItems defined for the gcTextBox, and adds the InvalidPairChar object to the collection.
    gcCommonValidator1.GetValidateItems(gcTextBox1).AddRange(new object[] {invalidPairChar1});
}
'  Please use the following namespace
'  Imports System.Windows.Forms;
'  Imports GrapeCity.Win.Editors;

Public Sub SetGcCommonValidatorSettings()
    ' Creates an instance of a GcTextBox control.
    Dim gcTextBox1 As New GcTextBox()
    ' Creates an instance of a GcCommonValidator component.
    Dim gcCommonValidator1 As New GcCommonValidator()
    ' Creates a FocusProcess object.
    Dim focusProcess1 As New FocusProcess()
    focusProcess1.PreventFocusLeave = True
    ' Creates an InvalidPairChar object.
    Dim invalidPairChar1 As New InvalidPairChar()
    Dim pairChar1 As New PairChar()
    Dim pairChar2 As New PairChar()
    Dim pairChar3 As New PairChar()
    Dim pairChar4 As New PairChar()
    pairChar1.Left = "["c
    pairChar1.Right = "]"c
    pairChar2.Left = "{"c
    pairChar2.Right = "}"c
    pairChar3.Left = "("c
    pairChar3.Right = ")"c
    pairChar4.Left = "「"c
    pairChar4.Right = "」"c
    invalidPairChar1.PairChars.AddRange(New PairChar() {pairChar1, pairChar2, pairChar3, pairChar4})

    ' Gets the ValidateActions defined for the gcTextBox, and adds the FocusProcess object to the collection.
    gcCommonValidator1.GetValidateActions(gcTextBox1).AddRange(New ValidateAction() {focusProcess1})
    ' Gets the ValidateItems defined for the gcTextBox, and adds the InvalidPairChar object to the collection.
    gcCommonValidator1.GetValidateItems(gcTextBox1).AddRange(New Object() {invalidPairChar1})
End Sub
参照

GcCommonValidator クラス
GcCommonValidator メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.