M
Mike Nicol
Hi all
I'm sure this is just something I'm doing wrong, but not too sure.
I have a form with a DataGridView control. The DataGridView (DGV) has
VirtualMode = True.
As a private member of the form, I have an array of booleans. The first
column of the DGV is a DataGridViewCheckBoxColumn.
So far, no problems. I've implemented the CellValueNeeded and
CellValuePushed functions, and all is A-OK. The user can happily click on
the different checkboxes, and I get the value changes in my array. (at this
point, I'd like to say... the DataGridView in VirtualMode RAWKS!!! .. nice
one MS).
I've implemented an Event Handler to handle the ColumnHeaderMouseClick
event. I want the user to be able to click the header of the column to
toggle the entire column values off or on. A "Select All" / "Unselect all"
function.
This works, except if a cell in the column, being toggled, is selected. The
DGV does not seem to fire the CellValueNeeded function for the selected
cell.
I've included a DGV.InvalidateColumn(e.columnindex) at the end of the
ColumnHeaderMouseClick event handler, to force it to redraw the column, but
alas, the cell is still not being refreshed. If I select a different cell,
the old cell is refresh (as expected).
I've fixed this problem by changing the focus at the start of the event
handler to one of the labels on the form. TA DA, this works.
I don't like crumby code like that, and was hoping someone could tell me
what I'm doing wrong.
I've tried to DGV.ClearSelection() at the beginning of the event handler,
still no luck. I've tried DGV.CancelEdit(), no luck.
Any ideas?
I'm sure this is just something I'm doing wrong, but not too sure.
I have a form with a DataGridView control. The DataGridView (DGV) has
VirtualMode = True.
As a private member of the form, I have an array of booleans. The first
column of the DGV is a DataGridViewCheckBoxColumn.
So far, no problems. I've implemented the CellValueNeeded and
CellValuePushed functions, and all is A-OK. The user can happily click on
the different checkboxes, and I get the value changes in my array. (at this
point, I'd like to say... the DataGridView in VirtualMode RAWKS!!! .. nice
one MS).
I've implemented an Event Handler to handle the ColumnHeaderMouseClick
event. I want the user to be able to click the header of the column to
toggle the entire column values off or on. A "Select All" / "Unselect all"
function.
This works, except if a cell in the column, being toggled, is selected. The
DGV does not seem to fire the CellValueNeeded function for the selected
cell.
I've included a DGV.InvalidateColumn(e.columnindex) at the end of the
ColumnHeaderMouseClick event handler, to force it to redraw the column, but
alas, the cell is still not being refreshed. If I select a different cell,
the old cell is refresh (as expected).
I've fixed this problem by changing the focus at the start of the event
handler to one of the labels on the form. TA DA, this works.
I don't like crumby code like that, and was hoping someone could tell me
what I'm doing wrong.
I've tried to DGV.ClearSelection() at the beginning of the event handler,
still no luck. I've tried DGV.CancelEdit(), no luck.
Any ideas?