Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete a row in DataGridView Control in VB.NET

I am working on DataGridView control in vb.net. I need help you that i want to delete a row in datagrid and only that row deleted who selected. Mean first i select the row then row deleted. So please provide me code that how i select and delete row from DataGridView control in VB.NET

thank

like image 431
user123456789 Avatar asked Dec 02 '22 17:12

user123456789


1 Answers

For Each row As DataGridViewRow In yourDGV.SelectedRows
    yourDGV.Rows.Remove(row)
Next

This will delete all rows that had been selected.

like image 83
AdorableVB Avatar answered Dec 13 '22 10:12

AdorableVB