Hello,
Is there a way to only allow digits and the period char to be entered into an editable cell of an UltraGrid without using a mask input?
The reason I am asking is because I have min/max ranges for each cell stored in a database and these values can be changed by the user, and if I use a mask input I have to find out how many prompt chars to show depending on the number of digits of the max value. So instead of showing prompt chars in the cell, I would like it to be completely blank when the user is typing into it, but only allow the user to enter digits and the period char to type in decimals.
Is there a way this can be done?
Thanks in advance,
Emma
Hi Emma,
I am attaching a sample that shows how I got it to work using the KeyDown Event.
Please let me know if this solution works for you and if you require further assistance.
Regards,Ari Shaposhnik
Hi Ariel,
Thank you for reply. I would like to be able to not allow any letters or symbols as the user is typing instead of waiting for the AfterExitEditMode event.
This can be done by using the AfterExitEditMode event and looking at the cell value, once you have that you can remove the anything that is not a digit or a period char from the cell. You should also make sure to implement the same for the KeyUp and KeyDown events. Another thing to consider is copy and paste, in this case you will have to look at what is currently in the clipboard and deny characters.
Please let me know if I can assist you further.
Thanks,
Ari Shaposhnik