1

I has one problem in i know how to delete single row with the help of header selction of a gatagridview. i want your help in which how can i delete a multiple rows using checkbox..... But i preserved a row sequence... how i can delete a row using checkbox in datagridview with a click of button......give me any reference for it ... site...or code.....

1 Answer 1

1

My Cell for the check box is called: ToDelete

Code in form for button:

Private Sub Button_Delete_Checked_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_Delete_Checked.Click
    For Each row As DataGridViewRow In DataGridView1.Rows
        If row.Cells("ToDelete").Value Then
            MessageBox.Show(row.Cells("SomeText").Value & " will be deleted.")

        End If

    Next
End Sub

alt text

Here's the grid to give you an idea of the fields and data I manually entered.

alt text Result of clicking the button.

You'll need to insert code to do the deletion in place of the messagebox code. You can get the row index with: row.Index.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.