How to get keypressed, keydown events from DataGridView data cells
问题 I need to receive the key press events during cell editing in DataGridView control. From what I have found on the net the DataGridView is designed to pass all key events from DataGridView to the cell editing control and you cannot get these events easily. I found this piece of code that traps those events for DataGrid control, but that does not work for DataGridView . 回答1: Try this: class KeyPressAwareDataGridView : DataGridView { protected override void OnControlAdded(ControlEventArgs e) {