/// <summary> /// method : btnInsert_Click /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnInsert_Click(object sender, EventArgs e) { var calcLine = txtReplacementValue.Text; var firstChar = calcLine[0]; if (firstChar == '+' || firstChar == '-') { var secondChar = calcLine[1]; if (char.IsDigit(secondChar)) { var calc = new CalcLine(calcLine); calculation.Insert(calc, lstCalculationLines.SelectedIndex + 1); } else { MessageBox.Show("The characters immediately following the first character must be numeric", "Error"); } } else { MessageBox.Show("The first character must be a + or - ", "Error"); } }