日期:2014-05-18 浏览次数:20937 次
dataGridView1.MultiSelect = false; dataGridView1.Rows[dataGridView1.RowCount - 1].Selected = true; dataGridView1.CurrentCell = dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[1];
------解决方案--------------------
这刚好以前做过,代码如下:
dgv_All.DataSource = _vioTable;
for (int i = 0; i < dgv_All.Rows.Count;i++)
{
if (i == dgv_All.Rows.Count - 1)
{
dgv_All.Rows[i].Selected = true;
}
else
{
dgv_All.Rows[i].Selected = false;
}
}
dgv_All.FirstDisplayedScrollingRowIndex = dgv_All.RowCount - 1;
------解决方案--------------------
同意一楼的解答。。。
------解决方案--------------------
private void Form1_Load(object sender, EventArgs e) { this.dgvShow.Columns.Add("11","22"); for (int i = 0; i < 100; i++) { this.dgvShow.Rows.Add(); dgvShow.Rows[i].Cells[0].Value = 2000 + i; } } private void btnDGVGo_Click(object sender, EventArgs e) { dgvShow.Rows[80].Selected = true; dgvShow.FirstDisplayedScrollingRowIndex = 80; }