On a WinForms application that I am writing in C#, I have a DataGridViewTextBoxColumn with cells holding integer values that I would like the users to be able to increment or decrement using the + and - keys from their keyboards.
I've handled the KeyDown event as it is what I use usually to handle Delete keys, etc, but it isn't working for Plus and Minus keys as pressing them causes the Cell to go in Edit-mode, and the KeyDown event is never fired for those keys as a result. Same for the KeyPress event
Actually, it is fired if I set the cells to readonly, but I am not happy with this solution as it would force me to set the property from true to false in several areas of my code and could quickly become messy.
What would please be the best way to achieve this?
Thanks.
Have you tried with this:
instead of using this: Keys.OemMinus use this: Keys.Subtract
and instead of using this: Keys.Oemplus use this: Keys.Add
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With