DataGridView中定位项
文本框中输入信息,想在ListView中自动定位到相应的项,这种做法给客户的体验比较好...没错...
方法如下:
代码
foreach (DataGridViewRow row in this.dgvSystemInfo.Rows)
{
if (row.Cells[2].Value.Equals(this.txtSearch.Text))
{
this.dgvSystemInfo.CurrentCell = row.Cells[2];//设置当前选择文本框
}
}
{
if (row.Cells[2].Value.Equals(this.txtSearch.Text))
{
this.dgvSystemInfo.CurrentCell = row.Cells[2];//设置当前选择文本框
}
}
CurrentCell 属性