Here is the coding for the BMI Calculator, a simple code with switch case statements to get the BMI value.
Dim wt, ht, bmi, htsq
'On Click of Button
Private Sub Command1_Click()
'The Calculation Part of BMI ---
'<--- Calculation Starts ----
wt = Val(Text1.Text)
ht = Val(Text2.Text)
'Height ---> Inches to Meters Conversion
ht = ht * 0.0254
htsq = ht * ht
bmi = (wt / htsq)
'Rounding the Float bmi to 2 decimal places
bmi = Format(bmi, "#00.00")
'Display the bmi float value
Label5.Caption = bmi
'To Display the Appropriate Text with respect to the value of BMI
Select Case bmi
Case Is < 18
Label3.Caption = "You are UnderWeight for your Height"
Case Is < 18.5
Label3.Caption = "You are Thin for your Height"
Case 18.6 To 24.9
Label3.Caption = "You are Healthy"
Case25 To 29.9
Label3.Caption = "You are OverWeight for your Height"
Case Is > 30
Label3.Caption = "You are Obese"
' --- Calculation Ends --->
Here the Text1, Text2 are the fields for getting the Weight in Kgs and Height in Inches.
Then on the Click of the Button (Command1) we display the output using Label5 which shows bmi value as float and Label3 which shows the statement as per bmi value.
The final product is as follows,