第一次作业第二题

#代码

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WindowsFormsApplication1

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

        private void textBox1_TextChanged(object sender, EventArgs e)

        {

        }

        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();  //将数值转换成字符

        }

        private void button2_Click(object sender, EventArgs e)

        {

            textBox1.Text = "";

            textBox2.Text = "";

            textBox3.Text = "";

        }

    }

}

#效果


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 招聘不理想,上午检查招聘网络发布,发现做事很粗糙,跟招聘经理一起从标题、公司介绍、公司形象照全部梳理整改。 下...
    董银超阅读 149评论 0 1
  • 每次来济南,最喜欢坐的车就是威海到北京的晚上出发的火车,早上5点40就可以到济南东站,出了站门口就是大明湖公园,金...
    花手鞠阅读 282评论 0 2
  • 2018年4月15日无锡女王跑,我完成了人生中的首次半马,不可思议。 离开跑两个月来,因搬家伤到脚,休息一个月,中...
    公子慧_ea67阅读 398评论 9 8