Private Sub Command1_Click()
Dim myHeight, stdWeight As Double
Dim myWeight, Fatness As Double
Dim myBMI, myBase, myAge As Double
myHeight = CDbl(Text1.Text)
myWeight = CDbl(Text2.Text)
myAge = CDbl(Text6.Text)
stdWeight = GetStandardWeight(myHeight)
Fatness = GetFatness(myWeight, stdWeight)
myBMI = GetBMI(myWeight, myHeight) '여기서 myHeight 표시됨
myBase = GetBase(myWeight, myHeight, myAge)
Label2.Caption = "당신의 표준 몸무게는 " + CStr(stdWeight) + " Kg입니다."
Text3.Text = Fatness
Text4.Text = myBMI
Text5.Text = myBase
If Fatness <= 10 Then
Label6.Caption = "정상"
ElseIf Fatness < 20 Then
Label6.Caption = "과체중"
Else
Label6.Caption = "비만"
End If
If myBMI < 18.5 Then
Label9.Caption = "저체중"
ElseIf myBMI >= 18.5 And myBMI <= 22.9 Then
Label9.Caption = "정상"
ElseIf myBMI >= 23 And myBMI <= 24.9 Then
Label9.Caption = "과체중"
ElseIf myBMI >= 25 And myBMI <= 29.9 Then
Label9.Caption = "1단계 비만"
Else
Label9.Caption = "2단계 비만으로 위험한 상태"
End If
End Sub
Public Function GetBase(ByVal Weight As Double, Height As Double, age As Double) As Double
Dim Base As Double
Base = 655 + (9.6 * Weight) + (1.8 * Height) - (4.7 * age)
GetBase = Base
End Function
Public Function GetBMI(ByVal Weight As Double, Height As Double) As Double
Dim BMI As Double
BMI = Weight / (Height * Height)
GetBMI = BMI
End Function
Public Function GetStandardWeight(ByVal Height As Double) As Double
Dim stdWeight2 As Double
stdWeight2 = (Height - 100) * 0.9
GetStandardWeight = stdWeight2
End Function
Public Function GetFatness(ByVal Weight As Double, stdWeight As Double) As Double
Dim fat As Double
fat = ((Weight - stdWeight) / Weight) * 100
GetFatness = fat
End Function
저기표시된데가 ByRef 에러뜨는데 이유를 모르겠어
머라카데요?
ㄴByRef arguement type mismatched ㅠㅠ
무슨뜻일까요
ㄴ어음 변수?형식 불일치아닌ㄱ.....