EDN Admin
Well-known member
i want to delete existing data in datagridview using loop . i write code below:
<pre> For i = 0 To dgvBook.Rows.Count - 1
stFileName = FileLocation_Name & "ImageBook_Front" & dgvBook.Rows(i).Cells("drISBN").Value.ToString.Trim & ".jpg"
If dgvBook.Rows(i).Cells("drISBN").Value.ToString.Trim = "041525406X" Then
MsgBox("OK")
End If
If FileExists(stFileName) = True Then
stList.Add(dgvBook.Rows(i).Index)
End If
Next[/code]
<br/>
but problem is that when data found and deleted row then orginal data index mismatch. and get error. how do make loop in up to down and delete row if match
View the full article
<pre> For i = 0 To dgvBook.Rows.Count - 1
stFileName = FileLocation_Name & "ImageBook_Front" & dgvBook.Rows(i).Cells("drISBN").Value.ToString.Trim & ".jpg"
If dgvBook.Rows(i).Cells("drISBN").Value.ToString.Trim = "041525406X" Then
MsgBox("OK")
End If
If FileExists(stFileName) = True Then
stList.Add(dgvBook.Rows(i).Index)
End If
Next[/code]
<br/>
but problem is that when data found and deleted row then orginal data index mismatch. and get error. how do make loop in up to down and delete row if match
View the full article