winform控件datagridview在CellSelect模式下获取行
winform控件 http://www.cnblogs.com/CodeAnyWhere/archive/2005/11/29/286551.html
datagridview在CellSelect模式下删除行
private void btnRemove_Click(object sender, EventArgs e)
{
List<int> rows = new List<int>();
foreach (DataGridViewCell cellEach in this.dgvCartonSN.SelectedCells)
{
int cellrow=cellEach.OwningRow.Index;
if (!rows.Contains(cellrow))
{
rows.Add(cellrow);
}
}
rows.Sort((x, y) => -x.CompareTo(y));
for (int i =0;i< rows.Count; i++)
{
dgvCartonSN.Rows.RemoveAt(rows[i]);
}
}

浙公网安备 33010602011771号