private void entryTypeDropdown_SelectedIndexChanged(object sender, EventArgs e) { ComboBox dropDown = sender as ComboBox; if (dropDown != null) { ExtraDropEntry entry = entriesListBox.SelectedItem as ExtraDropEntry; if (entry != null) { try { ExtraDropType type = (ExtraDropType)dropDown.SelectedItem; entry.SetType(type); } catch (InvalidCastException) { MessageBox.Show( "Error attempting to change type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } } }
public void SetType(ExtraDropType type) { Type = type; }