入力された文字を
Format プロパティに設定されてた入力マスクに従って自動的に変換するかどうかを取得または設定します。
書式を設定した
GcTextBox コントロールを作成するコード例を次に示します。この例では他に AutoConvert そして
Format プロパティを使用して、特定の文字の入力を許可する GcTextBox コントロールを作成しています。
// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
public void InitializeTextBox()
{
// Create an instance of a GcTextBox control.
GcTextBox gcTextBox1 = new GcTextBox();
// Allow the GcTextBox control to accept only upper case alphabet(A-Z) and SBCS space.
gcTextBox1.Format = "AS";
// The GcTextBox control will not try to convert invalid char to valid char automatically.
gcTextBox1.AutoConvert = false;
// Create an instance of a GcTextBox control.
GcTextBox gcTextBox2 = new GcTextBox();
// Accept upper and lower case alphabet, as well as the symbols. Except '#', '@' and '*' chars.
gcTextBox2.Format = @"aA@^\#\@*";
// The GcTextBox will try to convert the invalid char to valid char automatically.
gcTextBox2.AutoConvert = true;
}
' Please use the following namespace
' Imports System.Windows.Forms
' Imports GrapeCity.Win.Editors
Public Sub InitializeTextBox()
' Create an instance of a GcTextBox control.
Dim gcTextBox1 As New GcTextBox()
' Allow the GcTextBox control to accept only upper case alphabet(A-Z) and SBCS space.
gcTextBox1.Format = "AS"
' The GcTextBox control will not try to convert invalid char to valid char automatically.
gcTextBox1.AutoConvert = False
' Create an instance of a GcTextBox control.
Dim gcTextBox2 As New GcTextBox()
' Accept upper and lower case alphabet, as well as the symbols. Except '#', '@' and '*' chars.
gcTextBox2.Format = "aA@^\#\@*"
' The GcTextBox will try to convert the invalid char to valid char automatically.
gcTextBox2.AutoConvert = True
End Sub