FRM Member Oct 15, 2022 #1 End If Error while if Sub is being underlined. Please can someone help me with this. I am to give the category of Blood Pressure using the Systolic and diastolic BP. I just do not know where my End If is missing Private Sub btnCalBP_Click If IsNumber(edtSystolic.Text) = False Then edtDisBP.Text = "Please enter valid Systolic Value" Return Else If IsNumber(edtDiastolic.Text) = False Then 'check user typed number edtDiastolic.Text = "Please enter valid Diastolic Value" Return End If If edtSystolic.Text < 80 Then 'to prevent divide-by-zero in BMI calculation edtDisBP.Text = "Length seems very short " Return Else If edtSystolic.Text <50 Then edtDisBP.Text = "Enter Valid Weight" End If End If If edtSystolic.Text < edtDiastolic.Text Then edtDisBP.Text= "Invalid Values" End If Dim BPWords As String If (edtSystolic.Text <120) & (edtDiastolic.Text < 80) Then BPWords = "Normal" Else If (edtSystolic.Text < 140 ) Or (edtDiastolic.Text < 90) Then BPWords = "Prehypertension" If (edtSystolic.Text < 159) Or (edtDiastolic.Text < 100) Then BPWords = "High Blodd Pressure" Else If (edtSystolic.Text > 160 ) Or (edtDiastolic.Text > 100) Then BPWords = "High Blodd Pressure (Hypertension Stage 2)" Else edtDisBP.Text = "Hypertensive Crisis (EMERGENCY CARE NEEDED)" End If End If edtDisBP.Text = BPWords & " " End Sub
End If Error while if Sub is being underlined. Please can someone help me with this. I am to give the category of Blood Pressure using the Systolic and diastolic BP. I just do not know where my End If is missing Private Sub btnCalBP_Click If IsNumber(edtSystolic.Text) = False Then edtDisBP.Text = "Please enter valid Systolic Value" Return Else If IsNumber(edtDiastolic.Text) = False Then 'check user typed number edtDiastolic.Text = "Please enter valid Diastolic Value" Return End If If edtSystolic.Text < 80 Then 'to prevent divide-by-zero in BMI calculation edtDisBP.Text = "Length seems very short " Return Else If edtSystolic.Text <50 Then edtDisBP.Text = "Enter Valid Weight" End If End If If edtSystolic.Text < edtDiastolic.Text Then edtDisBP.Text= "Invalid Values" End If Dim BPWords As String If (edtSystolic.Text <120) & (edtDiastolic.Text < 80) Then BPWords = "Normal" Else If (edtSystolic.Text < 140 ) Or (edtDiastolic.Text < 90) Then BPWords = "Prehypertension" If (edtSystolic.Text < 159) Or (edtDiastolic.Text < 100) Then BPWords = "High Blodd Pressure" Else If (edtSystolic.Text > 160 ) Or (edtDiastolic.Text > 100) Then BPWords = "High Blodd Pressure (Hypertension Stage 2)" Else edtDisBP.Text = "Hypertensive Crisis (EMERGENCY CARE NEEDED)" End If End If edtDisBP.Text = BPWords & " " End Sub
klaus Expert Licensed User Longtime User Oct 15, 2022 #2 When you click in the IDE on an If keyword, its structure is highlighted like below: If you click on the If below you should see where the End If is missing: I leave it up to you you to find where it is missing. Upvote 0
When you click in the IDE on an If keyword, its structure is highlighted like below: If you click on the If below you should see where the End If is missing: I leave it up to you you to find where it is missing.
Erel B4X founder Staff member Licensed User Longtime User Oct 16, 2022 #4 @FRM I've already asked you once to post code with code tags. Please don't do it again. Upvote 0