網路教學(e-Learning)校園社群(e-Community)服務台(e-Service)系所班網(e-Class)登入
位置: 伍柏勲 > 未分類
VB BMI
by 伍柏勲 2012-09-29 23:30:14, 回應(0), 人氣(503)
Private Sub Command1_Click()
'-----合格體重判斷
Weightmini = Format((Text1.Text / 100) ^ 2 * 18.5, "0.0")
Weightmax = Format((Text1.Text / 100) ^ 2 * 24, "0.0")
Text4.Text = Str(Weightmini) + "到" + Str(Weightmax)
'-----BMI計算and建議判斷式
tall = Text1.Text / 100
Sum = Text2.Text / (tall * tall)
Text3.Text = Format(Sum, "0.0")
If Text3.Text < 18.5 Then
Text5.Text = "爸媽不給你飯吃麼?"
Shape1.BackColor = &HFF&
ElseIf Text3.Text >= 18.5 And Text3.Text < 24 Then
Text5.Text = "保持不錯 沒有太低或太高!!"
Shape1.BackColor = &HFF00&
ElseIf Text3.Text >= 24 And Text3.Text < 27 Then
Text5.Text = "過重 這不叫胖 這叫勇壯!!"
Shape1.BackColor = &HFF&
ElseIf Text3.Text >= 27 And Text3.Text < 30 Then
Text5.Text = "輕度肥胖 豬 不解釋!!"
Shape1.BackColor = &HFF&
ElseIf Text3.Text >= 30 And Text3.Text < 35 Then
Text5.Text = "中度肥胖 肥豬 不解釋 !!"
Shape1.BackColor = &HFF&
ElseIf Text3.Text >= 35 Then
Text5.Text = "重度肥胖 神豬 不解釋 !!"
Shape1.BackColor = &HFF&
End If
Timer1.Enabled = True
Text9.Text = "手機:0936965525"

End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Shape1.BackColor = &HFFFFFF
Label7.Caption = ""
End Sub

Private Sub Form_Load()
Text6.Text = "班級:系統三甲"
Text7.Text = "姓名:伍柏勳"
Text8.Text = "學號:49939058"
End Sub

Private Sub Label10_Click()

End Sub

Private Sub Text10_Change()

End Sub

Private Sub Timer1_Timer()
Label7.Caption = Date + Time
Timer1.Enabled = False
End Sub