Nov 16, 2009
So I've got 2 unbound datagridviews, and am providing a push/pull interface where the user can move records from one to the other.
View 5 Replies
Grid A is read-only and the selectionmode is set to FullRowSelect. Grid B has a read-only DataGridViewTextBoxCell, an editable DataGridViewComboBoxCell, and an editable DataGridViewComboBoxCell.
Because the grids have different columns, but represent the same records, my notion was to create the datagridviews with the same column structure but hiding certain columns, and then just move the DataGridViewRows back and forth between the two, which seams to work.
The problem is that if I go into column 2 or 3 in grid B, I get "Current cell cannot be set to an invisible cell".
I can select cells in column A and I'm fine. It should be noted that on grid B the hidden columns are 4-7.
I know there's a problem when the CurrentCell attribute is set to a hidden cell, but I'm clicking visible cells. I inserted a breakpoint on the CellClick event of the DGV, and again for column 1 that works fine, but on columns 2 and 3 it looks like the error is occuring before the event even gets fired.
Is something in the background setting CurrentCell to one of the hidden cells before firing the event?