Scrolling a "DataGridView" in an "OnCellValidating()" handler -
12-30-2007
, 06:05 PM
Does anyone know how to scroll a "DataGridView" during an
"OnCellValidating()" handler. If the cell being validated isn't currently in
view, I simply want to scroll it back into view before displaying any error
message. Note that "DataGridView.FirstDisplayedScrollingRowIndex" is the
obvious solution but you can't (easily) rely on this since it makes a
re-entrant call into the same "OnCellValidating()" handler among others (for
no valid reason I can think of). Circumventing this is no easy task however
as I've discovered over the past several hours. If someone knows of an
alternate way, possibly by adjusting the vertical scroll bar directly (using
"DataGridView.VerticalScrollBar" probably but I can't make this work
either), it would be greatly appreciated. Thanks in advance. |