Selasa, 07 Mei 2013

Contoh DataBase Dengan VB 6.0

 (PROGRAM DATABASE)
CODE PROGRAM
Private Sub cmdtambah_Click()
txtnoinduk.Text = “”
txtnama.Text = “”
cbojk.Text = “”
txttempatlahir.Text = “”
txttanggallahir.Text = “”
cboagama.Text = “”
txtalamat.Text = “”
txtnotlp.Text = “”
txtnamawali.Text = “”
txtpekerjaan.Text = “”
txtalamatwali.Text = “”
cbostatus.Text = “”
txttahunmasuk.Text = “”
cbokelas.Text = “”
txtwalikelas.Text = “”
txtnoinduk.SetFocus
End Sub
Private Sub cboagama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttahunmasuk.SetFocus
End If
End Sub
Private Sub cbojk_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttempatlahir.SetFocus
End If
End Sub
Private Sub cbokelas_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtwalikelas.SetFocus
End If
End Sub
Private Sub cmdedit_Click()
With Data1.Recordset
.Edit
End With
End Sub
Private Sub cmdsimpan_Click()
With Data1.Recordset
.AddNew
End With
End Sub
Private Sub cmdkeluar_Click()
PSN = MsgBox(“ANDA YAKIN INGIN KELUAR?”, vbCritical + vbYesNo, “PESAN”)
If PSN = vbYes Then
Unload Me
End If
End Sub
Private Sub cmdhapus_Click()
Data1.Recordset.Delete
Data1.Recordset.MoveFirst
End Sub
Private Sub Form_Load()
cbojk.AddItem “Laki-laki”
cbojk.AddItem “Perempuan”
cboagama.AddItem “Islam”
cboagama.AddItem “Protestan”
cboagama.AddItem “Katholik”
cboagama.AddItem “Hindu”
cboagama.AddItem “Budha”
cboagama.AddItem “Konghucu”
cbostatus.AddItem “Anak Kandung”
cbostatus.AddItem “Anak Angkat”
cbokelas.AddItem “VII”
cbokelas.AddItem “VIII”
cbokelas.AddItem “IX”
End Sub
Private Sub mnexit_Click()
PSN = MsgBox(“ANDA YAKIN INGIN KELUAR?”, vbCritical + vbYesNo, “PESAN”)
If PSN = vbYes Then
Unload Me
End If
End Sub
Private Sub txtalamat_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnotlp.SetFocus
End If
End Sub
Private Sub txtalamatwali_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cbostatus.SetFocus
End If
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cbojk.SetFocus
End If
End Sub
Private Sub txtnamawali_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtpekerjaan.SetFocus
End If
End Sub
Private Sub txtnoinduk_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub
Private Sub txtnotlp_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnamawali.SetFocus
End If
End Sub
Private Sub txtpekerjaan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtalamatwali.SetFocus
End If
End Sub
Private Sub txttahunmasuk_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cbokelas.SetFocus
End If
End Sub
Private Sub txttanggallahir_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cboagama.SetFocus
End If
End Sub
Private Sub txttempatlahir_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttanggallahir.SetFocus
End If
End Sub
Private Sub txtwalikelas_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtalamat.SetFocus
End If
End Sub

Tidak ada komentar:

Posting Komentar