为什么这段代码不起作用? 它返回一个意外的值实际上总= 0如何使用函数的返回值?
total = Cscore(TextBox1.Text) * CDbl(TextBox2.Text)
试图在这个
total = TextBox1.Text * TextBox2.Text
它返回预期值,但我需要textbox1.text传递给函数来获取理想值
的功能是本
Public Function Cscore(ByVal score As Integer) As Double
Select Case score
Case score = 100
Return 5.0
Case score >= 95
Return 5.0
Case score >= 90
Return 4.75
Case score >= 85
Return 4.5
Case score >= 80
Return 4.0
Case score >= 75
Return 3.5
Case score >= 70
Return 3.0
Case score >= 65
Return 2.5
Case score >= 60
Return 2.0
Case score < 60
Return 1.0
End Select
End Function
感谢我n advance
如果您告诉我们*以何种方式*代码不起作用,回答这个问题会容易得多。它会抛出一个错误吗?回报意想不到的价值,是什么?关闭我的头顶,通过将文本框的Text属性传递给该函数,导致从“字符串”到“int”的隐式转换... – 2010-09-05 01:58:38