视觉基础等于或大于 [英] visual basics equal to or grater than

查看:58
本文介绍了视觉基础等于或大于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨有人可以帮我一个简单的代码,我试着写一个代码,说明如果textbox1等于0在10之间,那么HandDecimal = 1否则如果textbox1等于10.1到100则HandDecimal = 3否则如果texbox1等于100.1并且比HandDecimal = 5更重要



这里是我输入的代码,但它对我不起作用。

< pre lang =vb> 如果 WeightDecimal = 0 < = 10 然后

HandDecimal = 1

ElseIf WeightTextBox.Text = 10 < = 100 然后

HandDecimal = 3

ElseIf WeightTextBox.Text> = 100 1 然后

HandDecimal = 5

结束 如果

谢谢你的答案。

解决方案

不能使用 TextBox.Text :这是字符串,不是数值;使用,例如, double.Parse(TextBox.Text) double.TryParse(TextBox.Text)

http://msdn.microsoft.com/en-us /library/system.double.parse.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.double.tryparse.aspx [ ^ ]。



你想说什么?你的 ... = 10< = 100 完全不清楚。您是要分配,比较为零还是检查订单?如果您需要检查订单(如您所说,0到10之间),它应该是:

  if   0 < = someValue< =  10  然后 ... 
' 取决于你想要的,省略一个或两个' ='从'< ='...





我不知道究竟建议的是什么:也许在继续之前,请阅读语法,查看一些手册中的大多数基本代码示例...



-SA


你想要检查WeightDecimal'的值应该是0到10

然后写下条件如下...

 如果  WeightDecimal> =  0   WeightDecimal< =  10   然后 



以便代码如下所示,...

 如果  WeightDecimal> =  0   WeightDecimal< =  10   然后 
HandDecimal = < span class =code-digit> 1
ElseIf Convert.ToDecimal(WeightTextBox.Text)> 10 Convert.ToDecimal(WeightTextBox.Text)< = 100 然后
HandDecimal = 3
ElseIf Convert.ToDecimal(WeightTextBox.Text)> = 100 1 然后
HandDecimal = 5
结束 如果



< br $>
快乐编码!

:)


hi can someone help me with a simple code, i am trying to write a code that says if textbox1 is equal to 0 between 10 then HandDecimal = 1 else if textbox1 is equal to 10.1 through 100 then HandDecimal = 3 else if texbox1 is equal to 100.1 and grater than HandDecimal = 5

here is the code i put, but it does not work for me.

If WeightDecimal = 0 <= 10 Then

        HandDecimal = 1

    ElseIf WeightTextBox.Text = 10 <= 100 Then

        HandDecimal = 3

    ElseIf WeightTextBox.Text >= 100.1 Then

        HandDecimal = 5

    End If

thanks for your answers.

解决方案

Don''t work with TextBox.Text: this is string, not a numeric value; work with, say, double.Parse(TextBox.Text) or double.TryParse(TextBox.Text):
http://msdn.microsoft.com/en-us/library/system.double.parse.aspx[^],
http://msdn.microsoft.com/en-us/library/system.double.tryparse.aspx[^].

What are you trying to say with your "… = 10 <= 100" is totally unclear. Are you trying to assign, compare to zero or check the order? If you need to check the order (as you say, "between 0 and 10"), it should be:

if 0 <= someValue <= 10 then ...
' depending on what you want, omit one or both '=' from '<=' ...



I don''t know what exactly to advise: perhaps, before going on, read on the syntax, look at most basic code samples in some manual…

—SA


you probebly want to check WeightDecimal''s value should be in 0 to 10
then write condition as below...

If WeightDecimal >= 0 and WeightDecimal <= 10 Then


so that code should be like below,...

If WeightDecimal >= 0 and WeightDecimal  <= 10 Then
          HandDecimal = 1
ElseIf Convert.ToDecimal(WeightTextBox.Text) > 10 and Convert.ToDecimal(WeightTextBox.Text) <= 100 Then
          HandDecimal = 3
ElseIf Convert.ToDecimal(WeightTextBox.Text) >= 100.1 Then
          HandDecimal = 5
End If



Happy Coding!
:)


这篇关于视觉基础等于或大于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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