If you remove rows then the
RowCount
will change and you will get an out of range exception.
You should gather what you want to remove first in a loop then remove them afterwards.
Dim toremove As New List(Of Integer)
For i = 0 To DataGridView1.RowCount - 1
If DataGridView1.Rows(i).Cells(0).Value.ToString() = "" Then
toremove.Add(i)
End If
Next
For each i as Integer in toremove
DataGridView1.Rows.RemoveAt(i)