B
Bartolome38
Guest
Hi,
Im confused, why I have to click twice to have the correct result on my program's equi and remarks txt box. I can only get correct display when i click the calculate grade button twice.
please let me know why this happening and how to resolve the code. below is my code
Private Sub cmdcalculate_Click()
Dim q1 As Double, q2 As Double, q3 As Double, ass1 As Double, ass2 As Double, sw1 As Double, sw2 As Double, exam As Double, grade As Double, equi As Double
Dim remarks As String
remarks = txtremarks.Text
q1 = Val(txtq1.Text)
q2 = Val(txtq2.Text)
q3 = Val(txtq3.Text)
ass1 = Val(txtass1.Text)
ass2 = Val(txtass2.Text)
sw1 = Val(txtsw1.Text)
sw2 = Val(txtsw2.Text)
exam = Val(txtexam.Text)
grade = Val(txtgrade.Text)
equi = Val(txtequi.Text)
txtgrade.Text = (((q1 + q2 + q3) / 3) * 0.3) + (((ass1 + ass2) / 2) * 0.2) + (((sw1 + sw2) / 2) * 0.2) + (exam * 0.3)
Select Case grade
Case grade >= 97 And grade <= 100
txtequi.Text = "1.00"
Case 93 To 96
txtequi.Text = "1.25"
Case 89 To 92
txtequi.Text = "1.50"
Case 85 To 88
txtequi.Text = "1.75"
Case 81 To 84
txtequi.Text = "2.00"
Case 77 To 80
txtequi.Text = "2.25"
Case 75 To 76
txtequi.Text = "2.50"
Case 72 To 74
txtequi.Text = "2.75"
Case 70 To 71
txtequi.Text = "3.00"
Case 65 To 69
txtequi.Text = "4.00"
Case grade >= 0 And grade <= 64
txtequi.Text = "5.00"
End Select
Select Case grade
Case grade >= 97 And grade <= 100
txtremarks.Text = "Extra Ordinary"
Case 93 To 96
txtremarks.Text = "Excellent"
Case 89 To 92
txtremarks.Text = "Very Good"
Case 85 To 88
txtremarks.Text = "Good"
Case 81 To 84
txtremarks.Text = "Very Satisfactory"
Case 77 To 80
txtremarks.Text = "Satisfactory"
Case 75 To 76
txtremarks.Text = "Fair"
Case 72 To 74
txtremarks.Text = "Passing Level"
Case 70 To 71
txtremarks.Text = "Poor Yet Passing Level"
Case 65 To 69
txtremarks.Text = "Conditional Failure"
Case grade >= 0 And grade <= 64
txtremarks.Text = "Failed"
End Select
End Sub
Thank you in advance...
Bart
Continue reading...
Im confused, why I have to click twice to have the correct result on my program's equi and remarks txt box. I can only get correct display when i click the calculate grade button twice.
please let me know why this happening and how to resolve the code. below is my code
Private Sub cmdcalculate_Click()
Dim q1 As Double, q2 As Double, q3 As Double, ass1 As Double, ass2 As Double, sw1 As Double, sw2 As Double, exam As Double, grade As Double, equi As Double
Dim remarks As String
remarks = txtremarks.Text
q1 = Val(txtq1.Text)
q2 = Val(txtq2.Text)
q3 = Val(txtq3.Text)
ass1 = Val(txtass1.Text)
ass2 = Val(txtass2.Text)
sw1 = Val(txtsw1.Text)
sw2 = Val(txtsw2.Text)
exam = Val(txtexam.Text)
grade = Val(txtgrade.Text)
equi = Val(txtequi.Text)
txtgrade.Text = (((q1 + q2 + q3) / 3) * 0.3) + (((ass1 + ass2) / 2) * 0.2) + (((sw1 + sw2) / 2) * 0.2) + (exam * 0.3)
Select Case grade
Case grade >= 97 And grade <= 100
txtequi.Text = "1.00"
Case 93 To 96
txtequi.Text = "1.25"
Case 89 To 92
txtequi.Text = "1.50"
Case 85 To 88
txtequi.Text = "1.75"
Case 81 To 84
txtequi.Text = "2.00"
Case 77 To 80
txtequi.Text = "2.25"
Case 75 To 76
txtequi.Text = "2.50"
Case 72 To 74
txtequi.Text = "2.75"
Case 70 To 71
txtequi.Text = "3.00"
Case 65 To 69
txtequi.Text = "4.00"
Case grade >= 0 And grade <= 64
txtequi.Text = "5.00"
End Select
Select Case grade
Case grade >= 97 And grade <= 100
txtremarks.Text = "Extra Ordinary"
Case 93 To 96
txtremarks.Text = "Excellent"
Case 89 To 92
txtremarks.Text = "Very Good"
Case 85 To 88
txtremarks.Text = "Good"
Case 81 To 84
txtremarks.Text = "Very Satisfactory"
Case 77 To 80
txtremarks.Text = "Satisfactory"
Case 75 To 76
txtremarks.Text = "Fair"
Case 72 To 74
txtremarks.Text = "Passing Level"
Case 70 To 71
txtremarks.Text = "Poor Yet Passing Level"
Case 65 To 69
txtremarks.Text = "Conditional Failure"
Case grade >= 0 And grade <= 64
txtremarks.Text = "Failed"
End Select
End Sub
Thank you in advance...
Bart
Continue reading...