using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp6 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public void NumericKey_Click(object sender, EventArgs args) { Button alpha = sender as Button; if (alpha == null) // The typecast failed return; // This... probably shouldn't ever happen anyway OutputText.AppendText(alpha.Text); if (OutputText.Text.Length > 3) // n,nnn and beyond { while (OutputText.Text.Contains(',')) { OutputText.Text = OutputText.Text.Remove(OutputText.Text.IndexOf(','), 1); } Int64 slacker = Convert.ToInt64(OutputText.Text); OutputText.Text = String.Format("{0:#,0}", slacker); } } public void ArithmeticButton_Click(object sender, EventArgs args) { Button alpha = sender as Button; if (alpha == null) // The typecast failed return; // This... probably shouldn't ever happen anyway //CurrentExpression.AppendText(alpha.Text + " " + OutputText.Text); CurrentExpression.Text = " " + alpha.Text + " " + OutputText.Text + " "+ CurrentExpression.Text; OutputText.Text = ""; } private void Clear_Button_Click(object sender, EventArgs e) { OutputText.Text = ""; //OutputText.Clear(); } } }