/// <summary> /// Delete the selected keyword /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnDelete_Click(object sender, EventArgs e) { int idx; if (dgvKeywords.SelectedRows.Count != 0) { idx = dgvKeywords.SelectedRows[0].Index; if (idx < keywords.Count) { dgvKeywords.EndEdit(); keywords.RemoveAt(idx); } } }