The reason it doesn't work is you are probably trying to get it while it
is in edit mode (a cell is being edited). In that case, the textbox is
getting the key presses, not the data grid.
You will have to find the windows handle of the editor, and hook into
that.