跪求高手雅正以下VB程序,我运行不了~~~

来源:百度知道 编辑:UC知道 时间:2024/06/14 21:10:19
老师留了一道关于体型判断的VB习题,h就是身高,单位是米,W是体重,单位是公斤,我编写了以下程序,运行时却老显示错误~~
Private Sub cmd1_Click()
Dim h As Single
Dim w As Integer
Dim t
h = Val(txtH.Text)
w = Val(txtW.Text)
t = w / h ^ 2
Select Case t
Case Is <= 18
txtR.Text = "低体重"
Case Is <= 25
txtR.Text = "体重正常"
Case Is <= 27
txtR.Text = "超重体重"
Case Else
txtR.Text = "肥胖"
End Select

End Sub

我不怎么懂VB

Dim h As Single
Dim w As Integer
Dim t
h = Val(txtH.Text)
w = Val(txtW.Text) 字符可以转成数字 字符串也能转成1个数字?? Text是整串吧?

Select Case t
Case Is <= 18
txtR.Text = "低体重"
Case Is <= 25
txtR.Text = "体重正常"
Case Is <= 27
txtR.Text = "超重体重"

上面是t,下面怎么变成Is了啊,VB的选择语句是这样的吗?