private void Operations_Calcu(object sender, EventArgs e) { //Excute the operator sign's from buttons Guna.UI2.WinForms.Guna2GradientButton opeer = (Guna.UI2.WinForms.Guna2GradientButton)sender; //check if the textbox empty or not if (Result_TextBox.Text == string.Empty) { MessageBox.Show("No numbers found", "No numbers founds", MessageBoxButtons.OK, MessageBoxIcon.Information); Result_TextBox.Focus(); } else { //Parse the numbers and do some operations operations = opeer.Text; //Generate the first number Result_value = double.Parse(Result_TextBox.Text); Operator_label.Text = Result_value.ToString() + operations; Result_TextBox.Text = ""; } }
private void guna2GradientButton15_Click(object sender, EventArgs e) { //Equal buttons if (Result_TextBox.Text == string.Empty) { MessageBox.Show("No numbers found", "No numbers founds", MessageBoxButtons.OK, MessageBoxIcon.Information); Result_TextBox.Focus(); } else // Generate the second numbers and define the operations { double value_two; value_two = double.Parse(Result_TextBox.Text); switch (operations) { case "+": Result_TextBox.Text = (Result_value + value_two).ToString(); break; case "-": Result_TextBox.Text = (Result_value - value_two).ToString(); break; case "X": Result_TextBox.Text = (Result_value * value_two).ToString(); break; case "/": Result_TextBox.Text = (Result_value / value_two).ToString(); break; default: break; } } }