我按照邵鹏鸣编写的《VS.C#程序设计基础教程》有个整数相乘的例子,可是输入数以后点相乘没有任何反应,希望高手帮忙!
代码如下:
using System;
using System.Text;
using System.Windows.Forms;namespace testint
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void button1_Click(object sender, EventArgs e)
        {
            int op1 = 0;
            int op2 = 0;
            int result = 0;            try
            {
                op1 = Int32.Parse(textBox1.Text);
            }
            catch (System.FormatException)
            {
                MessageBox.Show("左边输入的不是一个Double数");
                return;
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("左边输入的值超出便是范围");
                return;
            }
            try
            {
                op2 = Int32.Parse(textBox2.Text);
                return;
            }
            catch (System.FormatException)
            {
                MessageBox.Show("右边输入的不是一个Double数");
                return;
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("右边输入的值超出便是范围");
                return;
            }
            try 
            {
                result =checked(op1*op2);
            }
            catch (System.OverflowException)
            {
                MessageBox.Show("计算结果值超出int表示范围.");
                return;
            }
            textBox3.Text = result.ToString();
        }        private void button2_Click(object sender, EventArgs e)
        {
            textBox3.Text = "此处显示计算结果";
            textBox2.Text = "";
            textBox1.Text = "";
        }
    }
}