C语言编辑bmi计算器,使用事件处理程序的BMI计算器计算

因此,在我的BMI计算器上工作时,似乎无法使计算部分工作。我有三个文本框,其中包含完成计算所需的信息,英尺高度,英寸高度和磅磅。使用事件处理程序的BMI计算器计算

这是我的代码。什么似乎是我的错误?

Body Mass Index Calculator

void btnUS_Click(object sender, EventArgs e)

{

this.US.Visible = true;

this.Metric.Visible = false;

}

void btnMetric_Click(object sender, EventArgs e)

{

this.US.Visible = false;

this.Metric.Visible = true;

}

void calcUS_Click(object sender, EventArgs e)

{

string operand1 = heightus.Text;

string operand2 = heightus1.Text;

string operand3 = weightus.Text;

string bmi = resultus.Text;

double number;

bool isOperand1Number = Double.TryParse(operand1, out number);

bool isOperand2Number = Double.TryParse(operand2, out number);

bool isOperand3Number = Double.TryParse(operand3, out number);

if (isOperand1Number && isOperand2Number && isOperand3Number)

{

bmi = (((operand3/((operand1 * 12) + operand2) * (operand1 * 12) + operand2))) * 703);

}

else

{

Response.Write("Please type a numeric value into each of the text boxes.");

}

}

feet

inch(es)

lbs

+0

您能解释一下您面临的问题吗?什么是不工作等,这将有助于解决您的问题。 –

2013-03-13 19:07:24

+0

首先,您正在设置'bmi',但是您并未将该设置设置为页面上的任何内容以查看结果(如'resultus.Text = myResult')。其次,你正在使用字符串进行计算。第三,你应该把所有的代码移到代码隐藏中。第四,只需使用JavaScript! –

2013-03-13 19:07:45

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值