Articles in this section
Category / Section

How to Restrict Alphabetical Characters Cell in WinForms GridControl?

Restrict the alphabetical characters


By default, the NumericUpDown cell can allow entry of 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.

 

gridControl1[4, 4].CellType = GridCellTypeName.NumericUpDown;
GridNumericUpDownCellModel model = gridControl1.CellModels[GridCellTypeName.NumericUpDown] as GridNumericUpDownCellModel;
model.AcceptAlphaKeys = false;
gridControl1(4, 4).CellType = GridCellTypeName.NumericUpDown
Dim model As GridNumericUpDownCellModel = TryCast(gridControl1.CellModels(GridCellTypeName.NumericUpDown), GridNumericUpDownCellModel)
model.AcceptAlphaKeys = False

The Screenshot below displays the alphabet restriction of the cell in GridControl.

show the alphabet restriction in a grid cell

 

Samples:

C#: AlphabetRestriction_CS

VB: AlphabetRestriction_VB

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied