private void BorrarFilasSeleccionadas(DevExpress.XtraGrid.Views.Grid.GridView view) { if (view == null || view.SelectedRowsCount == 0) { return; } DataRow[] rows = new DataRow[view.SelectedRowsCount]; for (int i = 0; i < view.SelectedRowsCount; i++) { rows[i] = view.GetDataRow(view.GetSelectedRows()[i]); } view.BeginSort(); try { foreach (DataRow row in rows) { row.Delete(); } } finally { view.EndSort(); } }
private void DeleteFocusedRows(DevExpress.XtraGrid.Views.Grid.GridView view) { if (view.RowCount > 0 && view.IsValidRowHandle(view.FocusedRowHandle) && !view.IsNewItemRow(view.FocusedRowHandle)) { view.BeginSort(); try { view.DeleteRow(view.FocusedRowHandle); } catch (Exception) { } view.EndSort(); } }