如何将箭头设置为所选行。我是以编程框的值为基础以编程方式选择行。目前,只有行突出显示,箭头不符合
foreach (DataGridViewRow row in dgv.Rows)
{
if ((int)row.Tag == ma.ID)//ma.ID is the selected combo box value
{
row.Selected = true;
}
}
答案 0 :(得分:2)
您必须像这样更改CurrentCell
。
(这也将改变CurrentRow
)
foreach (DataGridViewRow row in dgv.Rows)
{
if ((int)row.Tag == ma.ID)//ma.ID is the selected combo box value
{
row.Selected = true;
dgv.CurrentCell = row.Cells[0];
}
}