//Edit shot button was clicked private void btnEditShotInfo_Click(object sender, EventArgs e) { int shot_index = listBoxShots.SelectedIndex; //Only continue if the selected index is 0 or greater if (shot_index >= 0) { //Display a new Keywordsform so the user can edit the keywords KeywordsForm form = new KeywordsForm(video_manager.FilteredShotList.ElementAt(shot_index).KeyWords); //Apply changes if user opted to save his changes if (form.ShowDialog(this) == DialogResult.OK) { String keywords = form.Keywords; String[] keywords_array = keywords.Split(';'); video_manager.editShotInfo(keywords_array, shot_index); //Dispose of the form form.Dispose(); } } //SelectedIndex is below zero - this shouldn't happend because the GUI shouldn't allow it else { MessageBox.Show("No shot selected", "Shot Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } updateShotList(); }