操作数问题 [英] operand question

查看:84
本文介绍了操作数问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

我是新编码员.

我正在使用Visual Studio2012.我正在构建Windows窗体.所以我有一个文本框"txtbox1",和标签"label1".我也有一个按钮"btn".我想要的是当我单击"btn"以及"txtbox1"中的值 大于或等于"5","label1";显示弱"消息在"label1"中.

I am using visual studio 2012. I am building a windows form. So i have a text box "txtbox1" and a label "label1". I also have a button "btn". What i want is when i click on "btn" and the value in "txtbox1" is greater than or equal "5", "label1" displays a message "weak" in "label1". 

这是我到目前为止所得到的:

This is what i got so far: 

 私有void btn_Click(对象发送者,EventArgs e)
        {
         如果(txtbox1.Text> = 5)

  private void btn_Click(object sender, EventArgs e)
        {
          if (txtbox1.Text >= 5)

        {         

        {          

          label1.Text =弱"; 

          label1.Text = "Weak"; 

         }

         }

        }

        }

然后我收到一条错误消息,提示操作员"是操作员".不能应用于类型为"string"的操作数.或"int".

then i get an error msg saying that "operator ">" can not be applied to operands of type "string" or "int".

有人可以帮我吗?

谢谢!

推荐答案

然后我收到一条错误消息,提示操作员"是操作员".不能应用于类型为"string"的操作数.或"int".

then i get an error msg saying that "operator ">" can not be applied to operands of type "string" or "int".

该消息告诉您,您无法将String与Integer进行比较,而无法获得明智的结果.但是,该代码不是Visual Basic代码,因此您的查询应发布在更适合您所使用语言的论坛中.

The message is telling you that you cannot compare a String to an Integer and get a sensible result.  However that code is not Visual Basic code, and your query should be posted in a forum more suitable to the language you are using.


这篇关于操作数问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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