在我的示例中,我得到了:
DataTable dt = SomeMethodThatFillsDataTable();
DataGridView dgv = new DataGridView;
dgv.DataSource = dt;
现在我想从 DataTable 中“挑选”一些 DataRows 并在 DataGridView 中突出显示它
DataRow[] foundRows = dt.Select("someColumn = someTerm");
foreach (DataRow row in foundRows)
{
DataGridViewRow dgvRow = // here i would like to get acces to DataGridViewRow "attached" to row
dgvRow.DefaultCellStyle.BackColor = Color.Red;
}
任何想法如何做到这一点?有可能吗?