private void mulButton_Click(object sender, EventArgs e) { bool flag1 = Regex.IsMatch(number1TextBox.Text, "[0-9.]{1,}$"); bool flag2 = Regex.IsMatch(number2TextBox.Text, "[0-9.]{1,}$"); if (flag1 == true && flag2 == true) { double num1 = Convert.ToDouble(number1TextBox.Text); double num2 = Convert.ToDouble(number2TextBox.Text); resultTextBox.Text = Convert.ToString(calculator.Mul(num1, num2)); } else { MessageBox.Show("Enter all TextField properly."); } }
private void multiplicationButton_Click(object sender, EventArgs e) { resultTextBox.Text = aCalculator.Mul(Convert.ToDouble(firstNumberTextBox.Text), Convert.ToDouble(secondNumberTextBox.Text)).ToString(); }