private void button_click(object sender, EventArgs e) { if ((TResult.Text == "0") || (operationPerformed)) { TResult.Clear(); dotCount = 0; } operationPerformed = false; Button b = (Button)sender; if (b.Text == "." && dotCount < 1) { dotCount++; TResult.Text = TResult.Text + b.Text; } if (b.Text != ".") { TResult.Text = TResult.Text + b.Text; } }