Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. Public Class BMICalculator
  2.  
  3. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCalculate.Click
  4. If IsNumeric(TxtBoxHeight.Text) Then
  5. Else
  6. TxtBoxHeight.Text = ""
  7. MsgBox("Please enter a value for height")
  8.  
  9. End If
  10. If IsNumeric(TxtBoxWeight.Text) Then
  11. Else
  12. TxtBoxWeight.Text = ""
  13. MsgBox("Please enter a value for weight")
  14. End If
  15. Dim BMI As Single
  16. Dim Height As Short
  17. Dim Weight As Short
  18. Height = CShort(TxtBoxHeight.Text)
  19. Weight = CShort(TxtBoxWeight.Text)
  20. BMI = (TxtBoxWeight.Text) / (TxtBoxHeight.Text * TxtBoxHeight.Text)
  21. BMI = CSng(BMI)
  22. Select Case BMI
  23. Case 0.0 To 18.5
  24. LblBMIAnalysis.Text = "You are underweight - Eat More"
  25. Case 18.5 To 29.9
  26. LblBMIAnalysis.Text = "You are normal - Keep Going"
  27. Case Is > 29.9
  28. LblBMIAnalysis.Text = "You are overweight - Exercise more and eat less"
  29. End Select
  30. BMIRESULT.Text = "Your BMI is" & BMI.ToString("F1")
  31. End Sub
  32.  
  33. Private Sub BMICalculator_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  34.  
  35. End Sub
  36. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement