2015-10-20 79 views
0

如何将箭头设置为所选行。我正在编程选择基于组合框的值的行。目前,只有该行被突出显示,箭头不遵循将DataGridView箭头设置为所选行

foreach (DataGridViewRow row in dgv.Rows) 
{ 
    if ((int)row.Tag == ma.ID)//ma.ID is the selected combo box value 
    { 
     row.Selected = true; 
    } 
} 

回答

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]; 
    } 
} 
相关问题