/// <summary> /// right click menu handler - delete /// </summary> public void miDelete_Click(Object sender, EventArgs e) { Console.WriteLine("Delete"); if (topCritter != null) { theModel.DeleteMarineLife(topCritter); } }
/// <summary> /// deletes a selected MarineLife object /// </summary> public void deleteMarineLife_btnClicked(Object Sender, EventArgs e) { if (lb_all_marine_life.SelectedIndex != -1) { theMarineLife = (MarineLife)theModel.MarineLifeList[lb_all_marine_life.SelectedIndex]; theModel.DeleteMarineLife(theMarineLife); } else { MessageBox.Show("You must select a critter in the list-view (displayed above) before attempting deletion.", "Error - No selection arguement", MessageBoxButtons.OK, MessageBoxIcon.Error); } }