更新时间:2023-02-09 13:58:02
当你在一个集合上迭代并同时修改它时,你需要反向工作以避免跳过行。
When you're iterating over a collection and modifying it at the same time, you need to work in reverse to avoid skipping rows.
For i = data.Rows.Count - 1 To 0 Step -1
(如果这不能解决问题,那么你需要解释一下不工作意味着。)
我能够使用这种方法让它工作......
I was able to get it work using this approach...
For i= data.Rows.Count - 1 To 0 Step -1
If String.IsNullOrEmpty(row.cell(1).Value) Then
data.Rows.RemoveAt(i)
End If