Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have datagrid view with checkbox column, how can i delete multiple checked rows?

i have these code but it doesnt work

VB
For i = 0 To dgvpurchaseOrders.RowCount - 1
            If Me.dgvpurchaseOrders.Rows(i).Cells(0).Value = True Then
                dgvpurchaseOrders.Rows.Remove(dgvpurchaseOrders.Rows(x))
            End If
Next
Posted

1 solution

start from the last row and iterate to first as below
VB
For x As Integer = dgvpurchaseOrders.Rows.Count - 1 To 0 Step -1
  If dgvpurchaseOrders.Rows(x).Cells(0).Value Then
    dgvpurchaseOrders.Rows.Remove(dgvpurchaseOrders.Rows(x))
  End If
Next
 
Share this answer
 
Comments
Cuculala 1-Jun-14 4:12am    
Thanks DamithSL for the help I've got it already :)

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