将 DataGridView 箭头设置为所选行
Set DataGridView arrow to the selected row
如何将箭头设置为选定的行。我正在根据组合框的值以编程方式选择行。目前只有行高亮显示,箭头不跟随
foreach (DataGridViewRow row in dgv.Rows)
{
if ((int)row.Tag == ma.ID)//ma.ID is the selected combo box value
{
row.Selected = true;
}
}
你必须像这样改变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];
}
}
如何将箭头设置为选定的行。我正在根据组合框的值以编程方式选择行。目前只有行高亮显示,箭头不跟随
foreach (DataGridViewRow row in dgv.Rows)
{
if ((int)row.Tag == ma.ID)//ma.ID is the selected combo box value
{
row.Selected = true;
}
}
你必须像这样改变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];
}
}