private void BtnAddFormula_Click(object sender, EventArgs e) { InputFormulaForm inputFormulaForm = new InputFormulaForm(); var result = inputFormulaForm.ShowDialog(); if (result == DialogResult.OK) { formulas.Add(inputFormulaForm.ReturnFormula); Logger.Log(inputFormulaForm.ReturnFormula); } BindingList <Formula> lis = new BindingList <Formula>(formulas); listBoxFormula.DataSource = lis; }
private void BtnEdit_Click(object sender, EventArgs e) { if (listBoxFormula.Items.Count != 0) { Logger.Log("Changed formula at index " + listBoxFormula.SelectedIndex + " It was " + listBoxFormula.SelectedItem.ToString()); InputFormulaForm inputFormulaForm = new InputFormulaForm(formulas[listBoxFormula.SelectedIndex]); var result = inputFormulaForm.ShowDialog(); if (result == DialogResult.OK) { formulas[listBoxFormula.SelectedIndex] = inputFormulaForm.ReturnFormula; Logger.Log(inputFormulaForm.ReturnFormula); } BindingList <Formula> lis = new BindingList <Formula>(formulas); listBoxFormula.DataSource = lis; } }