Redirect PreviewKeyDownEventArgs and MouseEventArg values to a DataGridView
By redirecting the PreviewKeyDownEventArgs and redirecting the values of the MouseEventArgs you can ensure scrolling and Up/Down/PageUp/PageDown/ etc. functionality for the DataGridView no matter which control has focus.
This can be usefull e.g. if you still want to scroll the DataGridView while editing a filter input in a TextBox.
- System.Windows.Forms
- System.Reflection
Add the code to the desired System.Windows.Forms.Form and change the name of dataGridView1 to the name of your own DataGridView.