private void button1_Click(object sender, EventArgs e) { try { account at = new account(); int M = int.Parse(txtNo1.Text.Trim()); int N = int.Parse(txtNo2.Text.Trim()); string str = comboBox1.Text; switch (str) { case "加": txtResult.Text = at.addition(M, N).ToString(); break; case "减": txtResult.Text = at.subtration(M, N).ToString(); break; case "乘": txtResult.Text = at.multiplication(M, N).ToString(); break; case "除": txtResult.Text = at.division(M, N).ToString(); break; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }