Friday, April 1, 2011

Select Case

Dim NilaiTm As Integer
Dim NilaiMid As Integer
Dim NilaiFinal As Integer
Dim NilaiAkhir As Integer
Dim Grade As String

Private Sub Command1_Click()
NilaiTm = Val(Text1.Text)
NilaiMid = Val(Text2.Text)
NilaiFinal = Val(Text3.Text)
NilaiAkhir = NilaiTm * 0.2 + NilaiMid * 0.3 + NilaiFinal * 0.5
Select Case NilaiAkhir

Case Is < 55
Grade = "E"
Case 55 To 64
Grade = "D"
Case 65 To 74
Grade = "C"
Case 75 To 84
Grade = "B"
Case Else
Grade = "A"
End Select
Text4.Text = NilaiAkhir
Text5.Text = Grade
End Sub

Private Sub Command2_Click()
Form3.Show
Hide
End Sub

Private Sub Command3_Click()
End
End Sub

No comments:

Post a Comment