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,我在运行时填充了 dataGridView 当我尝试更新网格时,它给了我错误:
“这个名单没有被清除。”
DataGrid_A.Rows.Clear() GetDataGrid()
我怎么解决这个问题?有什么建议吗?
您可以使用以下代码来获得所需的结果
do { foreach (DataGridViewRow row in DataGrid_A.Rows) { try { DataGrid_A.Rows.Remove(row); } catch (Exception) { } } } while (DataGrid_A.Rows.Count > 1);