How to delete selected rows from a DataGridView?

If you just want to remove the selected rows from the DataGridView this should do it:

foreach (DataGridViewRow row  in yourDataGridView.SelectedRows)
{
     yourDataGridView.Rows.RemoveAt(row.Index);
}

Your code didn't work because you've used RemoveAt(rows) but RemoveAt accepts only the index of the row which you want to remove. You are passing a DataGridViewSelectedRowCollection to it. You can get the index of a row via DataGridViewRow.Index as shown above.