Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个从datagridview我winform的数据库返回搜索结果的我。返回搜索后,我想从指定列中删除空行。这是一个例子:
datagridview
winform
假设我想删除类型#2列上具有空值的行。
#2
我完全被困住了。我该怎么做?
var rowsNull = (from a in dataGridView1.Rows.Cast<DataGridViewRow>() where a.Cells[2].Value == null select a).ToList(); foreach (DataGridViewRow item in rowsNull) { dataGridView1.Rows.RemoveAt(item.Index); }