Click here to Skip to main content
14,640,651 members
Rate this:
Please Sign up or sign in to vote.
Im using a CSV to load and save my DataGridView values,

With a press of a button, I want to be able to delete a row when it is checked via the checkbox column.

The code below is what I have tried but have had no success with. What can I do to get this to work?

What I have tried:

    Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
        For i As Integer = dataGVGeneral.Rows.Count() - 1 To 0 Step -1
            Dim Delete As Boolean
            Delete = dataGVGeneral.Rows(i).Cells(8).Value
            'If checkbox cell is checked
            If Delete = True Then
                Dim row As DataGridViewRow
                row = dataGVGeneral.Rows(i)
                dataGVGeneral.Rows.Remove(row)
            End If
        Next
    End Sub
End Class
Posted
Comments
Richard MacCutchan 29-Jul-20 3:52am
   
How are you loading the csv data to the DataGridView?
Shaheer Rizwan 29-Jul-20 3:53am
   
Via a button click

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100