更新后继续关注数据网格 [英] keep focus on datagrid after update
本文介绍了更新后继续关注数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有本地database.sdf和datagridview的数据输入表单,当我选择一行并更新它时,如何在更新后将焦点保持在所选行上而不是再次转到第一行
I have a data entry form with local database.sdf and a datagridview, when I select a row and update it, how do I keep focus on the selected row after update instead of it going to the first row again
推荐答案
Windows窗体解决方案:
您可以使用DataGridView.CurrentCell [ ^ ] property。
例如:
Solution for Windows Form:
You can use DataGridView.CurrentCell[^] property.
Example:
DataGridViewCell cell = this.dataGridView1.Rows[RowIndex].Cells[ColumnIndex];
//update
this.dataGridView1.CurrentCell = cell;
这篇关于更新后继续关注数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文