Hello,
One of my requirements is allowing the user input an int32 number in hex format, so the user could type "00000000" or "FFFFFFFF".
I'm using an UltraTextEditor with a DataFilter to convert to/from the hex string to the underlying integer. That seems to work fine.
However, I'd like to limit the characters the user can type, so only digits from 0 to 9 and letters from A to F are allowed. What's the best way to do this?
I think you will probably want to use the KeyDown event for this. You can check the key and if it's not from 0-9 or A-F, you could set e.Handled to true to cancel the keystroke.
The only tricky part of this is that you also have to handle pasting, so you will need to trap for CTRL+V and maybe Shift+Insert, as well.
Thanks for the answer Mike,
I'm hanlding the KeyDown event to check for valid characters, but e.Handled = true didn't work. I had to use e.SuppressKeyPress.
jabor said:does UltraGrid and the editors really not support hexadecimal integers inbuilt?
That is correct, there is no built-in support for this.
Hi Mike,
does UltraGrid and the editors really not support hexadecimal integers inbuilt?