Having trouble programming for body mass index. Entering 180 lbs, 72 " ht
Body Mass Index programming visual basic help
Collapse
X
-
ic Class Form1Originally posted by sashiHi there,
Please state the problem statement clearly. What is your formula? Is there any runtime error?
Private Sub BtnOne_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles BtnOne.Click
'determine BMI
'Declare variables
Dim weight As Double
Dim height As Double
height = CDbl(txtInches. Text)
Call input(weight)
Call DisplayBMI()
End Sub
Sub input(ByRef w As Integer)
'get values from text boxes
w = CDbl(txtWeight. Text)
End Sub
Function BMI(ByVal w As Double, ByVal h As Integer) As Double
'determine BMI
Dim weightb As Double
Dim heightsqr As Integer
weightb = w * 703
heightsqr = h * h
Return weightb / heightsqr
End Function
Sub DisplayBMI()
'display bmi in list box
Dim bodymass As Double
Dim weight As Double
weight = CDbl(txtWeight. Text)
bodymass = BMI(weight, Height)
With lstOutput.ItemsComment
Comment