Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can remove some rows in girdview

this code dosent work:
datagridview.rows.remove()
what should i do?
Posted

Try:
VB
' Remove currently selected row
Me.DataGridView1.Rows.Remove(Me.DataGridView1.SelectedRows(0))

Read: Datarowcollection remove[^]
 
Share this answer
 
If you want to remove all rows
VB
dgv1.Rows.Clear()


To remove by index
VB
dgv1.Rows.RemoveAt(0) ' removes first row


To remove row
VB
dgv1.Rows.Remove(dgv1.Rows(0)) ' removes first row
 
Share this answer
 

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