You need to create a context menu using the "Delete line" option in the designer. Then assign this property to the DGV (Data Grid View) ContextMenuStrip context menu.
Then double click on the delete line item and add this code:
DGV.Rows.Remove(DGV.CurrentRow);
You also need to add the MouseUp event for DGV, which allows the current cell to change when you right-click on it:
private void DGV_MouseUp(object sender, MouseEventArgs e) {
Miguel
source share