Listing
Program
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = Text3.Text
b = Text4.Text
c = (a * 70 / 100) + (b * 30 / 100)
If c >= 80 Then
Text5.Text = "A"
ElseIf c >= 60 Then
Text5.Text = "B"
ElseIf c >= 40 Then
Text5.Text = "C"
ElseIf c >= 20 Then
Text5.Text = "D"
ElseIf c >= 0 Then
Text5.Text = "E"
Else
Text5.Text = "error"
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("Nama")
= Text1.Text
Adodc1.Recordset.Fields("Mata_kuliah")
= Text2.Text
Adodc1.Recordset.Fields("Nilai_UTS")
= Text3.Text
Adodc1.Recordset.Fields("Nilai_UAS")
= Text4.Text
Adodc1.Recordset.Fields("Grade")
= Text5.Text
Adodc1.Recordset.Update
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.Delete
End Sub
Private Sub Command3_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
End Sub
Private Sub Command4_Click()
End
End Sub
Logika/Penjelasan Listing
Dim a As Integer
Dim b As Integer
Dim c As Integer
Blok
diatas adalah logika untuk memasukan variable berbentuk integer
If c >= 80 Then
Text5.Text = "A"
ElseIf c >= 60 Then
Text5.Text = "B"
ElseIf c >= 40 Then
Text5.Text = "C"
ElseIf c >= 20 Then
Text5.Text = "D"
ElseIf c >= 0 Then
Text5.Text = "E"
Else
Text5.Text = "error"
Blok
diatas adalah bentuk pecabangan dari visual basic
Adodc1.Recordset.Delete
Blok
diatas adalah untuk menghapus record pada datagrid
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Blok
diatas adalah untuk mengosongkan textbox yang telah kita isi


