Vb.net – Delete a row in DataGridView Control in VB.NET

datagridviewvb.netwinforms

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

Best Answer

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

This will delete all rows that had been selected.

Related Topic