Jumat, 17 Maret 2017

CARA MEMBUAT PROGRAM APLIKASI NILAI MAHASISWA

LANGKAH PERTAMA seperti biasa buka terlebih dulu VB 6.0
 

SELANJUTNYA desain sesuai dengan kebutuhan, contohnya seperti gambar ini
 

LANJUT kodenya seperti ini 

KODE TOMBOL PROGRAM KELUAR
Private Sub cmdkeluar_Click()
Unload Me
End Sub

KODE TOMBOL PROGRAM LAGI
Private Sub cmdlagi_Click()
txtnpm.Text = ""
txtnama.Text = ""
txtabsen.Text = ""
txtkuis.Text = ""
txttugas.Text = ""
txtuts.Text = ""
txtuas.Text = ""
txtnilaiakhir.Text = ""
label2.Caption = ""
txtnpm.SetFocus
End Sub

KODE TOMBOL PROGRAM PROSES
Private Sub cmdproses_Click()
txtnilaiakhir.Text = (Val(txtabsen.Text) + Val(txtkuis.Text) + Val(txttugas.Text) + Val(txtuts.Text) + Val(txtuas.Text)) / Val(5)
If txtnilaiakhir.Text >= 80 Then
label2.Caption = " A"
ElseIf txtnilaiakhir.Text >= 73 Then
label2.Caption = "B"
ElseIf txtnilaiakhir.Text >= 65 Then
label2.Caption = "C"
Else
label2.Caption = "BL"
End If
End Sub

KODE PROGRAM TXT ABSEN
Private Sub txtabsen_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtkuis.SetFocus
End If
End Sub

KODE PROGRAM TXT KUIS
Private Sub txtkuis_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttugas.SetFocus
End If
End Sub
KODE PROGRAM TXT NAMA
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtabsen.SetFocus
End If
End Sub

KODE PROGRAMTXT NPM
Private Sub txtnpm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub

KODE PROGRAM TUGAS
Private Sub txttugas_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtuts.SetFocus
End If
End Sub

KODE PROGRAM UTS
Private Sub txtuts_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
ttxtuas.SetFocus
End If
End Sub

TERAKHIR... coba jalankan programnya seperti ini
 

Tidak ada komentar:

Posting Komentar