DataGrid KeyDown and MouseDown Events and AllowSorting Property

  • Thread starter Thread starter Chuck Kosy
  • Start date Start date
C

Chuck Kosy

I'm trying to implement a lookup function via the F2 key
when pressed in data cells in selected columns of a
DataGrid. I'm also trying to implement the same lookup
function via a right-click of the mouse in a data cell of
the DataGrid.

I have KeyPreview set to True on the form. When anything
is keyed into a cell, the form's KeyDown event does not
fire nor does the DataGrid's KeyDown event fire. Is there
something I'm missing or is there a workaround that
doesn't involve a third-party data grid?

If I right-click a cell in the DataGrid, the MouseDown
event of the DataGrid does not fire. However, if I right-
click the header line, the MouseDown event does fire. Is
there something I'm missing here or is there a workaround?

I've set AllowSorting to False in the designer for the
DataGrid. In the form's Load routine, I customize the
DataGrid and again attempt to set the AllowSorting
property to False. The DataGrid still allows column
sorting when a column in the header line is left-clicked.
Is this property supposed to work or am I doing something
wrong?

Thanks.

Chuck
 
Back
Top