MESCIUS SPREAD for Windows Forms 15.0J
MaximumLength プロパティ (TextLengthValidator)
使用例 

テキストの最大の長さを取得または設定します。
構文
'宣言
 
Public Property MaximumLength As Integer
public int MaximumLength {get; set;}

プロパティ値

最大の長さ。デフォルト値はSystem.Int32.MaxValueです。
例外
例外解説
System.ArgumentOutOfRangeException.指定された値がMinimumLength未満です。
使用例
次のサンプルコードは、テキスト長バリデーターを使用します。
//Type a text string that contains more than 6 characters in cell 1,1 to see the error notification
FarPoint.Win.Spread.CellStyleNotify cnotify = new FarPoint.Win.Spread.CellStyleNotify();
cnotify.InvalidCellStyle.BackColor = Color.Aqua;
FarPoint.Win.Spread.TextLengthValidator tvalid = new FarPoint.Win.Spread.TextLengthValidator();
tvalid.LengthUnit = FarPoint.Win.Spread.LengthUnit.Char;
tvalid.MaximumLength = 6;
tvalid.MinimumLength = 0;
tvalid.NullIsValid = true;
tvalid.Actions.Add(cnotify);
fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), tvalid);
'Type a text string that contains more than 6 characters in cell 1,1 to see the error notification
Dim cnotify As New FarPoint.Win.Spread.CellStyleNotify()
cnotify.InvalidCellStyle.BackColor = Color.Aqua
Dim tvalid As New FarPoint.Win.Spread.TextLengthValidator()
tvalid.LengthUnit = FarPoint.Win.Spread.LengthUnit.Char
tvalid.MaximumLength = 6
tvalid.MinimumLength = 0
tvalid.NullIsValid = True
tvalid.Actions.Add(cnotify)
FpSpread1.Sheets(0).AddValidators(New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), tvalid)
参照

TextLengthValidator クラス
TextLengthValidator メンバ

 

 


© MESCIUS inc. All rights reserved.