zl程序教程

您现在的位置是:首页 >  IT要闻

当前栏目

C#学习笔记(3)

2023-03-14 10:26:44 时间
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 demo3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double inNum = Convert.ToDouble(textBox1.Text.Trim());
            double inCost = Convert.ToDouble(textBox2.Text.Trim());
            double inSale = Convert.ToDouble(textBox3.Text.Trim());
            double nowNum = inNum - inSale;
            double SaleMoney = inCost * inSale;

            label6.Text = Convert.ToString(nowNum);
            label7.Text = Convert.ToString(SaleMoney);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = textBox2.Text = textBox3.Text = label6.Text = label7.Text = "";
        }
    }
}