Click here to Skip to main content
15,066,928 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900