我在学VB.NET
尝试设置CurrentCell的值时,DataGridView组件有问题.
我想要做的是:
我有一个DataGridView与值.
我想在我的表单中创建一个按钮,当点击它时,我想将选择从当前行更改为下一个.要解释更多,点击我的按钮我想模拟鼠标点击DataGridview的效果.
我希望你能帮助我,
谢谢!
也许这样的事情:
@H_404_15@If DataGridView1.RowCount > 0 Then
Dim MyDesiredIndex As Integer = 0
If DataGridView1.CurrentRow.Index < DataGridView1.RowCount - 1 Then
MyDesiredIndex = DataGridView1.CurrentRow.Index + 1
End If
DataGridView1.ClearSelection()
DataGridView1.CurrentCell = DataGridView1.Rows(MyDesiredIndex).Cells(0)
DataGridView1.Rows(MyDesiredIndex).Selected = True
End If
注1:也许这两行不是必需的.我没有证明
@H_404_15@DataGridView1.ClearSelection() DataGridView1.CurrentCell = DataGridView1.Rows(MyDesiredIndex).Cells(0)注2:请注意,如果我们在最后一行,它将首先进行