DataGridView navigating to next row

前端 未结 7 822
野的像风
野的像风 2021-01-19 10:42

I have a C# winforms application and I am trying to get a button working that will select the next row in a datagridview after the one curently selected.

The code I

7条回答
  •  走了就别回头了
    2021-01-19 11:05

    It's here:

    dataGridView1.SelectedRows[selectedRowCount]
    

    If you have 3 selected rows then selectedRowCount = 3 and there are three rows with indexes: 0, 1, 2.

    You are trying to access #3 which doesn't exist.

提交回复
热议问题