简体   繁体   中英

Prevent scrolling to selected row in datagridview when a new row is added

I noticed that the Datagridview automatically scrolls to a row that the user selected when a record is added above the selected row. When the record is added below the selected row it does not jump to the selected row.

I would like to prevent it from jumping to the selected row when the record is placed above it. What can I do to get to behavior?

I also came across the same issue some time ago. I couldn't find a way to prevent that but set the focus to the previouly selected row by keeping that index in memory.

DataGridView.ClearSelection();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM