I have a label that calculates how many rows the datagridview has and certainly do not want a blank row to be included. It has a blank row at the very top of the datagridview and sometimes in the middle. If it is possible, I want to delete all empty rows.
This code is not working:
For i As Integer = 1 To DataGridView1.RowCount - 2 If DataGridView1.Rows(i).Cells(0).Value.ToString() = "" OrElse DataGridView1.Rows(i).Cells(8).Value.ToString() = "" Then DataGridView1.Rows.RemoveAt(i) i -= 1 End If Next
Edited 1 Year Ago by CodingSource