Articles in this section
Category / Section

How to restrict alphabetical characters in NumericUpDown 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

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)
Please sign in to leave a comment
Access denied
Access denied