Example #1
0
        /// <summary>
        /// method : btnUpdate_Click
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnUpdate_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.Replace(calc, lstCalculationLines.SelectedIndex);
                }
                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");
            }
        }