我需要实现下面的功能:点一个button之后,dataGridView的选中行自动到下一行。
下面是我写的代码
private void button1_Click(object sender, EventArgs e)
{
//dataGridView选中行自动移动到下一行
dataGridView1.CurrentRow.Index[(int)dataGridView1.CurrentRow.Index + 1];//不过这句是错的
}
功能很简单,就是不知道用什么属性来改变,请高手给说一下。谢谢
下面是我写的代码
private void button1_Click(object sender, EventArgs e)
{
//dataGridView选中行自动移动到下一行
dataGridView1.CurrentRow.Index[(int)dataGridView1.CurrentRow.Index + 1];//不过这句是错的
}
功能很简单,就是不知道用什么属性来改变,请高手给说一下。谢谢
this.dataGridView1.Rows[i].Selected
用ListView较多 觉得应该差不多
private void button1_Click(object sender, EventArgs e)
{
if (rowIndex < dataGridView1.RowCount)
{
dataGridView1.ClearSelection();
dataGridView1.Rows[rowIndex++].Selected = true;
}
}
dataGridView1.CurrentCell=dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex+1].Cell[0];
dateGridView.position+1