There is a DataGridView:

enter image description here

The delete button should delete the row selected in the DataGridView. Question: which method should be called to delete the selected line?

  • The answer depends on how this line gets there? Is there a data binding? - Alexander Petrov

1 answer 1

Here is this:

private void btnDelete_Click(object sender, EventArgs e) { foreach (DataGridViewRow item in this.имя_вашего_gridView.SelectedRows) { имя_вашего_gridView.Rows.RemoveAt(item.Index); } } 
  • And how from DataSet to delete the given line? - bsuart
  • @bsuart, look for information here . - Arthur Edgarov