How do I position a DataGridView to a specific row (so that the selected row is at the top)

How do I position a DataGridView to a specific row (so that the selected row is at the top)

勿忘初心 发布于 2021-11-29 字数 272 浏览 687 回复 2 原文

I have an application with a DataGridView on it and I would like to position the rows such that a specific row is at the top of the list.

I don't want a sort, I want a way to programmatically tell the DataGridView "scroll to the Nth row."

Any ideas?

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦罢 2022-06-07 2 楼

The DataGridView has a property called: FirstDisplayedScrollingRowIndex. Set that, and the row will then be at the top of the list.

归途 2022-06-07 1 楼