Programatically Selecting DatagridView Row



Although searching and selecting a datagridview row programatically based on a  condition works and highlights the selected row, datagridview doesn’t scroll  up or down if the selected/highlighted row is not visible within the full datagriview window requiring the user to manually scroll down or up to search/look for the selected/highlighted row.

Using pseudocode

for each row in datagridview row

if row condition is true

row.Selected = true

WinForms and VWG scroll down/up to make the selected/highlighted row visible.



  • You must to post comments

Selected and highlighted (current, focused) are different things. You can select row 1 and row 1000 at the same time which cannot possibly both be in view. The current (highlighted, focused) row/cell is always scrolled into view.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.