Calculate your Body Mass Index and understand your health status
Body Mass Index (BMI) is a simple calculation using a person's height and weight. The formula is BMI = kg/m2 where kg is a person's weight in kilograms and m2 is their height in meters squared.
A high BMI can indicate high body fatness. BMI screens for weight categories that may lead to health problems, but it does not diagnose the body fatness or health of an individual.
Enter your details below to calculate your BMI and understand your weight category.
This is the original VB6 implementation of the BMI Calculator:
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 VB6 version calculates BMI using the standard formula and displays the result formatted to two decimal places.
This is the modern VB.NET implementation with category detection:
Public Class BMICalculator Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click Dim height As Double = Double.Parse(txtHeight.Text) Dim weight As Double = Double.Parse(txtWeight.Text) Dim bmi As Double = CalculateBMI(height, weight) Dim category As String = GetBMICategory(bmi) lblResult.Text = $"Your BMI: {bmi:F2}" lblCategory.Text = $"Category: {category}" lblCategory.BackColor = GetCategoryColor(category) End Sub Private Function CalculateBMI(height As Double, weight As Double) As Double Return weight / (height * height) End Function Private Function GetBMICategory(bmi As Double) As String Select Case bmi Case Is < 18.5 : Return "Underweight" Case 18.5 To 24.9 : Return "Normal weight" Case 25 To 29.9 : Return "Overweight" Case Else : Return "Obesity" End Select End Function Private Function GetCategoryColor(category As String) As Color Select Case category Case "Underweight" : Return Color.LightBlue Case "Normal weight" : Return Color.LightGreen Case "Overweight" : Return Color.Orange Case Else : Return Color.LightCoral End Select End Function End Class
The VB.NET version enhances the original with category detection and color coding.
BMI is a useful measurement for most people over 18 years old. But it is only an estimate and it doesn't take into account age, ethnicity, gender and body composition.