public string Format {get; set;}
Public Property Format As String
プロパティ値
以下のキーワードを組み合わせた文字列を指定します。全角文字が指定された場合は全角文字が、半角文字が指定された場合は 半角文字がそれぞれ入力可能な文字種として指定されます。
全角 |
半角 |
説明 |
A |
A |
大文字のアルファベット(A~Z) |
a |
a |
小文字のアルファベット(a~z) |
K |
K |
カタカナ(促音・拗音の小書き表記あり) |
N |
N |
カタカナ(促音・拗音の小書き表記なし) |
9 |
9 |
数字(0~9) |
# |
# |
数字および数字関連記号(0~9、+ - $ % \ , .) |
@ |
@ |
記号 |
B |
B |
2進数(0または1) |
X |
X |
16進数(0~9、A~F、a-f) |
S |
S |
空白文字 |
J |
- |
ひらがな(促音・拗音の小書き表記あり) |
G |
- |
ひらがな(促音・拗音の小書き表記なし) |
Z |
- |
すべての全角文字 |
T |
- |
サロゲート ペア文字 |
D |
- |
2バイト文字(サロゲート ペア文字を除いた全角文字) |
I |
- |
JIS X 0208文字で構成された文字 |
M |
- |
Shift JIS文字で構成された文字 |
V |
- |
IVS(Ideographic Variation Sequence)文字 |
- |
H |
すべての半角文字 |
- |
^ |
指定した書式に含まれないすべての文字 |
- |
\ |
エスケープ・シーケンス |
既定値は
string.Emptyです。
書式を設定した
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