KELUAR
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
· ULANGI
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox8.Clear()
End Sub
· FORM LOAD
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("R001")
ComboBox1.Items.Add("R002")
ComboBox1.Items.Add("R003")
ComboBox1.Items.Add("R004")
ComboBox1.Items.Add("R005")
End Sub
· COMBOBOX
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.Text = "R001" Then
TextBox1.Text = "Marlboro"
TextBox2.Text = 11000
ElseIf ComboBox1.Text = "R002" Then
TextBox1.Text = "Sampoerna"
TextBox2.Text = 10000
ElseIf ComboBox1.Text = "R003" Then
TextBox1.Text = "Surya"
TextBox2.Text = 10000
ElseIf ComboBox1.Text = "R004" Then
TextBox1.Text = "Club Mild"
TextBox2.Text = 7000
ElseIf ComboBox1.Text = "R005" Then
TextBox1.Text = "Piala Mas"
TextBox2.Text = 6000
End If
End Sub
· HITUNG
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'untukmendapatkan total harga
TextBox4.Text = Val(TextBox2.Text) * Val(TextBox3.Text)
'untukmendapatkandiskon
If TextBox3.Text >= 10 Then
TextBox5.Text = Val(TextBox4.Text) * 0.1
Else
TextBox5.Text = 0
End If
TextBox6.Text = Val(TextBox4.Text) - Val(TextBox5.Text)
TextBox7.Focus()
End Sub
End Class
Gambar Program Nilai Mahasiswa
PublicClass Form1
· NIM
PrivateSub TextBox1_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
TextBox2.Focus()
EndIf
EndSub
· NAMA
PrivateSub TextBox2_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
'Fungsi Enter
If e.KeyChar = Chr(13) Then
ComboBox1.Focus()
EndIf
EndSub
· JURUSAN
PrivateSub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
TextBox3.Focus()
EndSub
· ALAMAT
PrivateSub TextBox3_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
If e.KeyChar = Chr(13) Then
TextBox4.Focus()
EndIf
EndSub
· NILAI TGAS
PrivateSub TextBox4_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
If e.KeyChar = Chr(13) Then
TextBox5.Focus()
EndIf
EndSub
· NILAI QUIS
PrivateSub TextBox5_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
If e.KeyChar = Chr(13) Then
TextBox6.Focus()
EndIf
EndSub
· NILAI UTS
PrivateSub TextBox6_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
If e.KeyChar = Chr(13) Then
TextBox7.Focus()
EndIf
EndSub
· NILAI UAS
PrivateSub TextBox7_KeyPress(ByVal sender AsObject, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox7.KeyPress
If e.KeyChar = Chr(13) Then
TextBox8.Focus()
EndIf
EndSub
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
TextBox8.Enabled = False
TextBox9.Enabled = False
EndSub
*HITUNG*
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tugas, quis, uts, uas, akhir AsInteger
Dim keterangan AsString
tugas = TextBox4.Text
quis = TextBox5.Text
uts = TextBox6.Text
uas = TextBox7.Text
akhir = (tugas * 0.5) + (quis * 0.1) + (uts * 0.2) + (uas * 0.2)
TextBox8.Text = akhir
'untuk menentukan keterangan
'If akhir >= 96 And akhir <= 100 Then
'keterangan = "A"
'ElseIf akhir >= 90 And akhir <= 95 Then
'keterangan = "AB"
'ElseIf akhir >= 80 And akhir < 89 Then
'keterangan = "B"
'ElseIf akhir >= 70 And akhir < 79 Then
'keterangan = "BC"
'ElseIf akhir >= 60 And akhir < 69 Then
'keterangan = "C"
'ElseIf akhir >= 50 And akhir < 59 Then
'keterangan = "D"
'ElseIf akhir <= 49 Then
'keterangan = "ERROR"
'End If
SelectCase akhir
Case 96 To 100
keterangan = "A"
Case 90 To 95
keterangan = "AB"
Case 80 To 89
keterangan = "b"
Case 70 To 79
keterangan = "BC"
Case 60 To 69
keterangan = "C"
Case 50 To 59
keterangan = "D"
CaseIs<= 49
keterangan = "ERROR"
EndSelect
TextBox9.Text = keterangan
EndSub
0 komentar:
Posting Komentar