我写了一个程序,我得到了像text =" 0" [英] I wrote a program bt I got error like text="0"

查看:74
本文介绍了我写了一个程序,我得到了像text =" 0"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    txtafricancoffee.Text = "0";
    txtAmerican.Text = "0";
    txtBlack.text = "0";
    txtboston.text = "0";
    txtcappuccino.Text = "0";
    Txtcarlton.Text = "0";
    txtcoffee.Text = "0";
    txtespresso.Text = "0";
    txticedcappuccino.Text = "0";
    txticedlatte.Text = "0";
    txtkilburn.text = "0";
    txtlagos.Text = "0";
    txtlattle.Text = "0";
    txtqueens.Text = "0";
    Txtred.Text = "0";
    txtvalue.Text = "0";
    lblcostcakes.Text = "0";
    lblcostdrink.Text = "0";
    lblservice.text = "1.75";
}





我尝试过:



i尝试所有这些我也搜索谷歌但我找不到任何东西



What I have tried:

i have try all the this i also search on google but i cant find anything

推荐答案

这是因为C#区分大小写: .text与.Text不同。

尝试用大写的'T'替换以小写't'开头的所有.Text:

That's because C# is case sensitive: ".text" is not the same as .Text".
Try replacing all the ".Text" that starts with a lowercase 't' with uppercase 'T':
txtafricancoffee.Text = "0";
txtAmerican.Text = "0";
txtBlack.Text = "0";
txtboston.Text = "0";
txtcappuccino.Text = "0";
Txtcarlton.Text = "0";
txtcoffee.Text = "0";
txtespresso.Text = "0";
txticedcappuccino.Text = "0";
txticedlatte.Text = "0";
txtkilburn.Text = "0";
txtlagos.Text = "0";
txtlattle.Text = "0";
txtqueens.Text = "0";
Txtred.Text = "0";
txtvalue.Text = "0";
lblcostcakes.Text = "0";
lblcostdrink.Text = "0";
lblservice.Text = "1.75";

虽然你可能想检查你的控件n ames以及:有些是正确的camelCased: txtAmerican txtBlack ,而有些则不是: txtafricancoffee txtboston - 如果它们也不匹配,你也会收到错误。

Though you might want to check your control names as well: Some are correctly camelCased: txtAmerican, txtBlack, while some aren't: txtafricancoffee, txtboston - if they don't match either, you will get an error on them also.


这篇关于我写了一个程序,我得到了像text =" 0"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆