BMI Calculator

[Back to Sample VB Programs]

A lot of people are obese nowadays and it could affect their health seriously . If your BMI is more than 30, you are considered obese. You can refer to the following range of BMI values for your weight status.

This BMI calculator is a Visual Basic program that can calculate the body mass index, or BMI of a person based  on the body weight in kilogram and the body height in meter. BMI can be calculated using the formula    weight/( height )2, where weight is measured in kg and height in meter. If you only know your weight and height in lb and feet, then you need to convert them to the metric system.

The Code

Private Sub Command1_Click()
    Label4.Caption = BMI(Text1.Text, Text2.Text)
End Sub

Private Function BMI(height, weight)
      BMIValue = (weight) / (height ^ 2)
      BMI = Format(BMIValue, "0.00")
End Function

The Interface

[Back to Sample VB Programs]

Copyright ® 2008 Dr.Liew Voon Kiong . All rights reserved |Contact

[Privacy Policy]