如何移动光标到datagridview的下一行光标、datagridview

由网友(余生无你)分享简介:我有一个包含2 datagridviews和它们之间的按钮将数据传送Windows窗体。我想不出我应该如何移动选定行的光标移到下一行后,该按钮已成功地传输数据。 解决方案 如果(dataGridView1.CurrentRow!= NULL)dataGridView1.CurrentCell =dataGridVi...

我有一个包含2 datagridviews和它们之间的按钮将数据传送Windows窗体。我想不出我应该如何移动选定行的光标移到下一行后,该按钮已成功地传输数据。

解决方案

 如果(dataGridView1.CurrentRow!= NULL)
    dataGridView1.CurrentCell =
        dataGridView1的
        .Rows [Math.Min(dataGridView1.CurrentRow.Index + 1,dataGridView1.Rows.Count  -  1)]
        .Cells [dataGridView1.CurrentCell.ColumnIndex]
 

I have a Windows Form that contains 2 datagridviews and a button between them to transfer the data. I cannot figure out how should i move the cursor of selected row to the next row after the button has successfully transfer the data.

解决方案 VSCode 大佬们都在用的快捷键 提升开发效率,建议先收藏

if (dataGridView1.CurrentRow != null)
    dataGridView1.CurrentCell =
        dataGridView1
        .Rows[Math.Min(dataGridView1.CurrentRow.Index + 1, dataGridView1.Rows.Count - 1)]
        .Cells[dataGridView1.CurrentCell.ColumnIndex];

阅读全文

相关推荐

最新文章