Professional Documents
Culture Documents
Source Code FUNGSI IF
Source Code FUNGSI IF
Option Explicit
Dim Hitung As Double
Private Sub Combo1_Click()
If Combo1.Text = "Merah" Then
Shape1.BackColor = vbRed
MsgBox "Warna Merah Coy....", vbOKOnly + vbInformation, "Latihanku"
End If
End Sub
End Sub
Private Sub Command2_Click()
Hitung = (Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text)) / 3
Label9.Caption = Format(Hitung, "##.##")
If Hitung >= 80 Then
Label10.Caption = "A"
Label11.Caption = "Istimewa"
ElseIf Hitung >= 70 Then
Label10.Caption = "B"
Label11.Caption = "Baik"
ElseIf Hitung >= 60 Then
Label10.Caption = "C"
Label11.Caption = "Cukup"
ElseIf Hitung >= 50 Then
Label10.Caption = "D"
Label11.Caption = "Kurang"
Else
Label10.Caption = "E"
Label11.Caption = "Sangat Kurang"
End If
End Sub
End Sub