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 = ""; } } }
原文:http://blog.csdn.net/jkxqj/article/details/20140929