private void btnEquals_Click(object sender, RoutedEventArgs e) { try { string s = txtInput.Text; Parser parser = new Parser(); double val = parser.evaluate(s); hist.addEntry(s); txtInput.Text = val.ToString(); isEvaluated = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } }