入力する文字数をバイト単位で制限する方法はありますか?

文書番号 : 38937     文書種別 : 使用方法     登録日 : 2015/07/01     最終更新日 : 2015/07/01
文書を印刷する
対象製品
SPREAD for Windows Forms 8.0J
詳細
GcTextBox型セルのMaxLengthUnitプロパティをByteに設定することで、入力する文字数をバイト単位で制限することができます。

◎サンプルコード(VB)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  ' GcTextBox型セルの設定
  Dim gctxt As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
  gctxt.MaxLength = 4
  ' MaxLengthの単位をバイトに設定
  gctxt.MaxLengthUnit = GrapeCity.Win.Spread.InputMan.CellType.LengthUnit.Byte
  FpSpread1.ActiveSheet.Columns(0).CellType = gctxt
End Sub


◎サンプルコード(C#)
private void Form1_Load(object sender, EventArgs e)
{
  // GcTextBox型セルの設定
  GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType gctxt = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
  gctxt.MaxLength = 4;
  // MaxLengthの単位をバイトに設定
  gctxt.MaxLengthUnit = GrapeCity.Win.Spread.InputMan.CellType.LengthUnit.Byte;
  fpSpread1.ActiveSheet.Columns[0].CellType = gctxt;
}
キーワード
セル型