private void Button_Click(object sender, RoutedEventArgs e) { Calculation c = new Calculation(calculationInput.Text); string result_list; try { c.calculate(); result_list = calculationInput.Text + " = " + c.getResult();// + "\n" + calculationOutput.Text; } catch (InvalidTokenException ite) { result_list = calculationInput.Text.Trim() + " ---> ERROR"; #if ERRORMESSAGES result_list += ": "+ite.Message; #endif } catch (Exception ex) { result_list = calculationInput.Text.Trim() + " ---> ERROR"; #if ERRORMESSAGES result_list += ": " + ex.Message; #endif } //calculationOutput.Items.Insert(0, result_list); //calculationOutput.Text = "+\n3\t4"; calculationOutput.Text = result_list + '\n' + calculationOutput.Text; }