![](/img/trans.png)
[英]How to set focus to a newly added row or at the end of a row in datagridview?
[英]Set focus to a row in datagridview that has been newly inserted or updated?
如何將焦點設置為datagridview中新插入或更新的行? 因此,一個插入/更新操作不必去查找用戶已插入/更新的數據。
我可以使用此=>( DataGridView-使用代碼可以將焦點放在帶有(*)的空白行上嗎? )
嘗試,它可能對您有所幫助,
// dataGridView1.Rows[0].Cells[1].Selected = true;
dataGridView1.Focus();
dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells[2];
如果它以交叉線程結尾等等,那么只需調用新方法即可。
早上好,
if (theGrid.Rows.Count > 0)
{
theGrid.CurrentCell = theGrid.Rows[theGrid.Rows.Count - 1].Cells[0];
}
SendKeys.Send("{DOWN}");
轉到最后一行,找到新行。
只需更改行索引
dataGridView1.CurrentCell = dataGridView1.Rows[datagridview.rows.count].Cells[2];
int LastIndex = dataGridView1.Rows.Count - 1;
dataGridView1.Rows[LastIndex].Cells[1].Focus();
這就是在asp.net C#中執行的方法
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.