public void editInstrument() { try { if (lstInstruments.SelectedValue != null) { FrmInstrument.DispatchInstrumentForm(lstInstruments.SelectedValue as clsAllInstruments); updateDisplay(); } else { MessageBox.Show("Please select an instrument to edit.", "No Instrument selected"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void add_Click(object sender, EventArgs e) { try { string lcReply = new InputBox(clsAllInstruments.FACTORY_PROMPT).Answer; if (!string.IsNullOrEmpty(lcReply)) // not cancelled? { clsAllInstruments lcInstrument = clsAllInstruments.NewWork(lcReply[0]); if (lcInstrument != null) // valid instrument created? { lcInstrument.CategoryName = _Category.CategoryName; FrmInstrument.DispatchInstrumentForm(lcInstrument); if (!string.IsNullOrEmpty(lcInstrument.InstrumentName)) // not cancelled? { refreshFormFromDBAsync(_Category.CategoryName); FrmMain.Instance.UpdateDisplayAsync(); } } } } catch (Exception) { } }