private void spreadsheetControl_RowsRemoving(object sender, RowsChangingEventArgs e) { if (blnEliminaRegistros == true) { blnEliminaRegistros = false; DialogResult intEliminaRegistro = MessageBox.Show("Desea Eliminar las lineas elegidas ", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation ); if (intEliminaRegistro == DialogResult.Yes) { blnCanceloEliminacionRegistros = false; List <int> elementos = new List <int>(); elementos = this.ObtenerFilasMarcadas(); if (elementos.Count > 0) { this.EliminarFilas(elementos); } } else { blnCanceloEliminacionRegistros = true; } } if (blnCanceloEliminacionRegistros == true) { e.Cancel = true; } }
private void spreadsheetControl1_RowsRemoving(object sender, RowsChangingEventArgs e) { Worksheet sheet = spreadsheetControl1.ActiveWorksheet; CellRange rowRange = sheet.Range.FromLTRB(0, e.StartIndex, 16383, e.StartIndex + e.Count - 1); CellRange boundRange = sheet.DataBindings[0].Range; // If the rows to be removed belong to the data-bound range, // display a dialog requesting the user to confirm the deletion of records. if (boundRange.IsIntersecting(rowRange)) { DialogResult result = MessageBox.Show("Want to delete the selected supplier(s)?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); applyChangesOnRowsRemoved = result == DialogResult.Yes; e.Cancel = result == DialogResult.No; return; } }