代码比较简单,如下
private void searchSolution_button_Click(object sender, EventArgs e)
{
string solutionName = tagetSolution_textBox.Text;
if (string.IsNullOrWhiteSpace(solutionName) || solutionList.RowCount <= 0)
{
return;
}
foreach (DataGridViewRow row in solutionList.Rows)
{
if (solutionName.Equals(row.Cells[1].Value.ToString()))
{
row.Selected = true;
solutionList.FirstDisplayedScrollingRowIndex = row.Index;
break;
}
}
}