Category / Section
How to Restrict Alphabetical Characters Cell in WinForms GridControl?
1 min read
Restrict the alphabetical characters
By default, the NumericUpDown cell can allows to enter both the alphabets and number characters. In order to restrict only the number characters, the NumericUpDown can be customized using the AcceptAlphaKeys property by deriving model from GridNumericUpDownCellModel class.
C#
gridControl1[4, 4].CellType = GridCellTypeName.NumericUpDown; GridNumericUpDownCellModel model = gridControl1.CellModels[GridCellTypeName.NumericUpDown] as GridNumericUpDownCellModel; model.AcceptAlphaKeys = false;
VB
gridControl1(4, 4).CellType = GridCellTypeName.NumericUpDown Dim model As GridNumericUpDownCellModel = TryCast(gridControl1.CellModels(GridCellTypeName.NumericUpDown), GridNumericUpDownCellModel) model.AcceptAlphaKeys = False
Screen shot
Samples: