新手,第一次发,想知道这个程序错在哪里
程序代码:
using System; using System.Collections.Generic; using using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using namespace 价格计算 { public partial class 盈亏计算 : Form { public 盈亏计算() { InitializeComponent(); } private void yj_TextChanged(object sender, EventArgs e) { try { double y = 0.996 * Convert.ToDouble(xj.Text) - 1.004 * Convert.ToDouble(yj.Text); double zdgj = 1.008 * Convert.ToDouble(yj.Text) + 0.002; zd.Text = Convert.ToString(zdgj); if (y > 0.002) { yl.Text = "是"; } else yl.Text = "否"; } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void xj_TextChanged(object sender, EventArgs e) { try { double y = 0.996 * Convert.ToDouble(xj.Text) - 1.004 * Convert.ToDouble(yj.Text); if (y > 0.002) { yl.Text = "是"; } else yl.Text = "否"; } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void yl_Click(object sender, EventArgs e) { try { double y = 0.996 * Convert.ToDouble(xj.Text) - 1.004 * Convert.ToDouble(yj.Text); if (y > 0.002) { yl.Text = "是"; } else yl.Text = "否"; } catch (Exception) { } } private void 盈亏计算_Load(object sender, EventArgs e) { xj.Text = "0"; yj.Text = "0"; } } }