2018-10-17第二题

2018-10-17  本文已影响0人  额丶丶丶

创建界面

编写代码

1.按钮1

private void button1_Click(object sender, EventArgs e)

        {

            float num1 = 0;      //定义

            float num2 = 0;

            float result = 0;

            num1 = float.Parse(textBox1.Text); //字符转数值

            num2 = float.Parse(textBox2.Text);

            result = num1 * num2;

            textBox3.Text = result.ToString(); //数值转字符

        }

2.按钮2

        private void button2_Click(object sender, EventArgs e)

        {

            textBox1.Text = "";

            textBox2.Text = "";

            textBox3.Text = "";

        }

上一篇下一篇

猜你喜欢

热点阅读