RemoveSelectedRows

        public static bool RemoveSelectedRows(this DataGridView dgv)
        {
            try
            {
                if (dgv.RowCount > 0)
                {
                    if (dgv.SelectedRows.Count == dgv.Rows.Count)
                    {
                        dgv.DataSource = null;
                    }

                    foreach (DataGridViewRow row in dgv.SelectedRows)
                    {
                        dgv.Rows.Remove(row);
                    }
                }

                return true;
            }
            catch (Exception exc)
            {
                return false;
            }
        }
Example:
DataGridView dgvCaseList = new DataGridView();
dgvCase.RemoveSelectedRows();

Description

Removes all selected rows from datagridview and returns the response on success

Details

Double click on the code to select all.

 

;