Catching a keypress in a DataGrid?
Posted on 2005-05-12
I'd like to catch the KeyPress or the TextChanged event of a datagrid - it doesn't really matter which.
However, I've tried just about everything imaginable and it still doesn't work. I've registered the form's KeyPress event, the DataGrid's KeyPress event, and the KeyPress events of individual TextBoxes in the TextBoxColumns.
The closest I can get is, when I have all of these event handlers registered, to get the handler to fire after I edit text in a DataGrid cell, then move to another cell and edit its text too. Is there any way I can catch the very first KeyPress? I have tried to call Focus() on the DataGrid, TextBoxColumns, etc. but it doesn't help.