Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions TombLib/TombLib.Forms/Controls/DarkDataGridViewControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,14 @@ private void butDelete_Click(object sender, EventArgs e)
selectedRowIndices.Sort();
selectedRowIndices.Reverse();

//Remove rows
DataGridView.CurrentCell = null;
DataGridView.ClearSelection();

// Remove rows
var rows = DataGridView.EditableRowCollection;
foreach (var selectedRowIndex in selectedRowIndices)
if (selectedRowIndex < rows.Count)
if (selectedRowIndex >= 0 && selectedRowIndex < rows.Count)
rows.RemoveAt(selectedRowIndex);

//Remove selection
foreach (var selectedRow in DataGridView.SelectedRows.Cast<DataGridViewRow>().ToList())
selectedRow.Selected = false;
}

private void butUp_Click(object sender, EventArgs e)
Expand Down