我们在想数据库中添加记录后往往会希望将GridView跳转到新添行,
在DeveExpress中可以这样实现
//根据单位名称定位当前行
string searchtxt = "字符串";
GridColumn column = dataGridView1.Columns["订货单位名称"];
int rhFound = dataGridView1.LocateByDisplayText(dataGridView1.FocusedRowHandle + 1, column, searchtxt);
dataGridView1.FocusedRowHandle = rhFound;
在dataGridView中可以这样实现
//获取行值
dataGridView1.CurrentCell = dataGridView1.Rows[ID].Cells["列名"];
如何定位和查找指定列显示值的行(注意是列的实显示值,而不是关联数据源列值)
using DevExpress.XtraGrid.Views.base;
using DevExpress.XtraGrid.Columns;