c# - 在 dataGridView 中移动索引

标签 c# datagridview

我正在使用它:Datagridview.DataSource= Table 现在变量“Table”中有这些:

PersonID|LName
-----------
1|TEST1
----------
2|TEST2
----------
3|TEST3

现在我想做一个从当前行移动到下一行的按钮 例如

从该状态

enter image description here

enter image description here

如果从第一行到第二行看不懂 只需将指针移至下一行

编辑: 查看图片中的“>”<==>指针,我如何将其移动到下一行/上一行/行

在这里找到答案: How to move cursor to the next row in datagridview

最佳答案

您必须更改 CurrentRow 属性才能使三角形移动。但是,CurrentRow 是只读的。根据MSDN Documentation您必须设置 CurrentCell下一行中单元格的属性以使其更改:

To change the current row, you must set the CurrentCell property to a cell in the desired row.

关于c# - 在 dataGridView 中移动索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25536167/

相关文章:

C# Auto Property - 这是 'pattern' 最佳实践吗?

c# - DataGridView:对所有选定的行应用编辑

c# - DataGridViewCheckBoxColumn : FormatException on boolean-column

c# - 更改单个 DataGridView 列中所有单元格的填充

c# - 如何从wpf中的datagridview更新多个基于表

c# - 使用 Entity Framework 从 2 个表返回数据

c# - 为什么 ConfigurationSection 需要使用字符串查找内容?

C# DataGridView 检查是否为空

C# 阻止组合框 selectionChanged 事件调用自身

c# - 使用 WCF 数据服务保存对象及其相关对象