Private Sub Command1 Click()
Dim tz As Single, sg As Single, bmiAs Single
tz = Val(Text1.Text)
sg = Val(Text2.Text)
If(sg。0) Then
bmi= tz/(sg *sg)
Text3.Text = bmi
If (bmi< 18.5) Then
Label4.Caption = "你的體重偏瘦"
Else
If (bmi >= 18.5 And bmi < 24) ThenLabel4.Caption=“你的體重正常”
Else
Label4.Caption=“你的體重偏重"EndIf
End If
End If
End Sub
uj5u.com熱心網友回復:
啥問題?就是舍不得說一下,別人就要看你的代碼?uj5u.com熱心網友回復:
改好了,你可以對比一下:
Private Sub Command1_Click()
Dim tz As Single, sg As Single, bmi As Single
tz = Val(Text1.Text)
sg = Val(Text2.Text)
If (sg > 0) Then
bmi = tz / (sg * sg)
Text3.Text = bmi
If (bmi < 18.5) Then
Label4.Caption = "你的體重偏瘦"
Else
If (bmi >= 18.5 And bmi < 24) Then
Label4.Caption = "你的體重正常"
Else
Label4.Caption = "你的體重偏重"
End If
End If
End If
End Sub
運行示例:

下載地址:
鏈接:https://pan.baidu.com/s/1qTWGrrJz50olpz2qnpmg1w
提取碼:v782
uj5u.com熱心網友回復:
https://bbs.csdn.net/topics/392559008跟這帖的題主是同學吧
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/37003.html
標籤:VB基礎類
