Berikut adalah sourch code untuk membuat aplikasi Pendaftaran Siswa menggunakan VB 6.0….
1. Pertama Buka VB 6.0 kamu…
2. buat project baru..
3. jangan lupa sourch code ini menggunakan database SQL yaa…
hehehehe….
4. buat project baru dengan desain sbb
5. lalu masukan sourch code SBB
Dim kata As String
Dim baru As Boolean
Dim strSQL As String
Private Sub Form_Load()
kata = “–> SMA MUHAMMADYA 1 KEPANJEN TERAKREDITASI ‘A’ <– “
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label10.ForeColor = &HE0E0E0
Label10.BackStyle = 0
Label10.BorderStyle = 0
Label11.ForeColor = &HE0E0E0
Label11.BackStyle = 0
Label11.BorderStyle = 0
Label12.ForeColor = &HE0E0E0
Label12.BackStyle = 0
Label12.BorderStyle = 0
End Sub
Private Sub Label10_Click()
baru = True
Frame1.Visible = True
Label15.Caption = “Tambah Data”
p_baru
End Sub
Private Sub Label10_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label10.ForeColor = &H0&
Label10.BackStyle = 1
Label10.BackColor = &H80FFFF
Label10.BorderStyle = 1
End Sub
Private Sub Label11_Click()
baru = False
Frame1.Visible = True
Label15.Caption = “Edit Data”
txt_no.Text = Text1.Text
t_agm.Text = txtagm.Text
t_almt1.Text = rtb1.Text
t_almt2.Text = rtb2.Text
t_almt3.Text = rtb3.Text
t_ay.Text = txtnm_a.Text
t_hp.Text = txthp_or.Text
t_ib.Text = txtnm_i.Text
t_jalur.Text = Combo1.Text
t_jk.Text = txtjns_kel.Text
t_kdp1.Text = txtkd_possw.Text
t_kdp2.Text = txtkd_possk.Text
t_kdp3.Text = txtkd_pos.Text
t_nama.Text = txtnm_swa.Text
t_nm_sek.Text = txtnm_skolah.Text
t_pday.Text = txtpnddkan_a.Text
t_pdib.Text = txtpenddikan_i.Text
t_phay.Text = txtpnghsilan_a.Text
t_phib.Text = txtpnghsilan_i.Text
t_pkay.Text = txtpkrjaan_a.Text
t_tglhr.Value = txttgl_lhr.Text
t_tlhr.Text = txttmpt_lhr.Text
t_tlp1.Text = txttelp_sw.Text
t_tlp2.Text = txttelp_sk.Text
t_tlp3.Text = txttelp.Text
t_kats.Text = c_jsek.Text
End Sub
Private Sub Label11_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label11.ForeColor = &H0&
Label11.BackStyle = 1
Label11.BackColor = &H80FFFF
Label11.BorderStyle = 1
End Sub
Private Sub Label12_Click()
If MsgBox(“Apakah Anda Yakin Akan Menghapus Data ?”, vbQuestion + vbYesNo, “Konfirmasi”) = vbYes Then
strSQL = “DELETE FROM t_swa_baru WHERE no_dftr=’” & Text1.Text & “‘”
DE.mCon.Execute strSQL
DE.rsp_siswa.Close
If DE.rsp_siswa.State = 0 Then DE.rsp_siswa.Open
If MsgBox(“Data Terhapus Refresh Data Base ?”, vbInformation + vbYesNo, “Konfirmasi”) = vbYes Then
Unload Me
Load Me
Form1.Show
End If
End If
End Sub
Private Sub Label12_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label12.ForeColor = &H0&
Label12.BackStyle = 1
Label12.BackColor = &H80FFFF
Label12.BorderStyle = 1
End Sub
Private Sub Timer1_Timer()
kata = Right(kata, Len(kata) – 1) & Left(kata, 1)
Label7.Caption = kata
End Sub
Private Sub XpBs1_Click(Index As Integer)
On Error Resume Next
With DE.rsp_siswa
Select Case Index
Case 0
.MoveFirst
MsgBox “Data Awal”
Case 1
If .AbsolutePosition > 1 Then .MovePrevious
If .AbsolutePosition = 1 Then MsgBox “Data Awal”
Case 2
If .AbsolutePosition < .RecordCount Then .MoveNext
If .AbsolutePosition = .RecordCount Then MsgBox “Data Ahir”
Case 3
.MoveLast
MsgBox “Data Ahir”
End Select
End With
End Sub
Private Sub XpBs2_Click()
If MsgBox(“Apakah Anda Yakin ?”, vbYesNo + vbQuestion, “Konfirmasi”) = vbYes Then
If baru = True Then
strSQL = “INSERT INTO t_swa_baru(no_dftr,jns_pdftran,nm_swa,tmpt_lhr,tgl_lhr,jns_kel,agm,alamat,telp_sw,kd_possw,kat_skolah,” & _
“nm_skolah,alamat_skolah,telp_sk,kd_possk,nm_a,pkrjaan_a,pnddkan_a,pnghsilan_a,nm_i,penddikan_i,pnghsilan_i,almat_or,telp,hp_or,kd_pos)” & _
“VALUES(‘” & txt_no.Text & “‘,’” & t_jalur.Text & “‘,’” & t_nama.Text & “‘,’” & t_tlhr.Text & “‘,’” & t_tglhr.Value & “‘,” & _
“‘” & t_jk.Text & “‘,’” & t_agm.Text & “‘,’” & t_almt1.Text & “‘,’” & t_tlp1.Text & “‘,’” & t_kdp1.Text & “‘,’” & t_kats.Text & “‘,” & _
“‘” & t_nm_sek.Text & “‘,’” & t_almt2.Text & “‘,’” & t_tlp2.Text & “‘,’” & t_kdp2.Text & “‘,’” & t_ay.Text & “‘,’” & t_pkay.Text & “‘,’” & t_pday.Text & “‘,” & _
“‘” & t_phay.Text & “‘,’” & t_ib.Text & “‘,’” & t_pdib.Text & “‘,’” & t_phib.Text & “‘,’” & t_almt3.Text & “‘,’” & t_tlp3.Text & “‘,’” & t_hp.Text & “‘,” & _
“‘” & t_kdp3.Text & “‘)”
DE.mCon.Execute strSQL
ElseIf baru = False Then
strSQL = “UPDATE t_swa_baru SET jns_pdftran=’” & t_jalur.Text & “‘,nm_swa=’” & t_nama.Text & “‘,” & _
“tmpt_lhr=’” & t_tlhr.Text & “‘,tgl_lhr=’” & t_tglhr.Value & “‘,jns_kel=’” & t_jk.Text & “‘,agm=’” & t_agm.Text & “‘,alamat=’” & t_almt1.Text & “‘,” & _
“telp_sw=’” & t_tlp1.Text & “‘,kd_possw=’” & t_kdp1.Text & “‘,kat_skolah=’” & t_kats.Text & “‘,nm_skolah=’” & t_nm_sek.Text & “‘,alamat_skolah=’” & t_almt2.Text & “‘,” & _
“telp_sk=’” & t_tlp2.Text & “‘,kd_possk=’” & t_kdp2.Text & “‘,nm_a=’” & t_ay.Text & “‘,pkrjaan_a=’” & t_pkay.Text & “‘,pnddkan_a=’” & t_pday.Text & “‘,” & _
“pnghsilan_a=’” & t_phay.Text & “‘,nm_i=’” & t_ib.Text & “‘,penddikan_i=’” & t_pdib.Text & “‘,pnghsilan_i=’” & t_phib.Text & “‘,almat_or=’” & t_almt3.Text & “‘,” & _
“telp=’” & t_tlp3.Text & “‘,hp_or=’” & t_hp.Text & “‘,kd_pos=’” & t_kdp3.Text & “‘ WHERE no_dftr=’” & txt_no.Text & “‘”
DE.mCon.Execute strSQL
End If
DE.rsp_siswa.MoveFirst
Frame1.Visible = False
DE.rsp_siswa.Close
If DE.rsp_siswa.State = 0 Then DE.rsp_siswa.Open
If MsgBox(“Data Tersimpan Refresh Data Base ?”, vbInformation + vbYesNo, “Konfirmasi”) = vbYes Then
Unload Me
Load Me
Form1.Show
End If
End If
End Sub
Private Sub XpBs3_Click()
Frame1.Visible = False
End Sub
6. Nah lalu coba jalankan dah…
Sourch code dapat di download
Dim kata As String
Dim baru As Boolean
Dim strSQL As String
Private Sub Form_Load()
kata = “–> SMA MUHAMMADYA 1 KEPANJEN TERAKREDITASI ‘A’ <– “
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label10.ForeColor = &HE0E0E0
Label10.BackStyle = 0
Label10.BorderStyle = 0
Label11.ForeColor = &HE0E0E0
Label11.BackStyle = 0
Label11.BorderStyle = 0
Label12.ForeColor = &HE0E0E0
Label12.BackStyle = 0
Label12.BorderStyle = 0
End Sub
Private Sub Label10_Click()
baru = True
Frame1.Visible = True
Label15.Caption = “Tambah Data”
p_baru
End Sub
Private Sub Label10_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label10.ForeColor = &H0&
Label10.BackStyle = 1
Label10.BackColor = &H80FFFF
Label10.BorderStyle = 1
End Sub
Private Sub Label11_Click()
baru = False
Frame1.Visible = True
Label15.Caption = “Edit Data”
txt_no.Text = Text1.Text
t_agm.Text = txtagm.Text
t_almt1.Text = rtb1.Text
t_almt2.Text = rtb2.Text
t_almt3.Text = rtb3.Text
t_ay.Text = txtnm_a.Text
t_hp.Text = txthp_or.Text
t_ib.Text = txtnm_i.Text
t_jalur.Text = Combo1.Text
t_jk.Text = txtjns_kel.Text
t_kdp1.Text = txtkd_possw.Text
t_kdp2.Text = txtkd_possk.Text
t_kdp3.Text = txtkd_pos.Text
t_nama.Text = txtnm_swa.Text
t_nm_sek.Text = txtnm_skolah.Text
t_pday.Text = txtpnddkan_a.Text
t_pdib.Text = txtpenddikan_i.Text
t_phay.Text = txtpnghsilan_a.Text
t_phib.Text = txtpnghsilan_i.Text
t_pkay.Text = txtpkrjaan_a.Text
t_tglhr.Value = txttgl_lhr.Text
t_tlhr.Text = txttmpt_lhr.Text
t_tlp1.Text = txttelp_sw.Text
t_tlp2.Text = txttelp_sk.Text
t_tlp3.Text = txttelp.Text
t_kats.Text = c_jsek.Text
End Sub
Private Sub Label11_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label11.ForeColor = &H0&
Label11.BackStyle = 1
Label11.BackColor = &H80FFFF
Label11.BorderStyle = 1
End Sub
Private Sub Label12_Click()
If MsgBox(“Apakah Anda Yakin Akan Menghapus Data ?”, vbQuestion + vbYesNo, “Konfirmasi”) = vbYes Then
strSQL = “DELETE FROM t_swa_baru WHERE no_dftr=’” & Text1.Text & “‘”
DE.mCon.Execute strSQL
DE.rsp_siswa.Close
If DE.rsp_siswa.State = 0 Then DE.rsp_siswa.Open
If MsgBox(“Data Terhapus Refresh Data Base ?”, vbInformation + vbYesNo, “Konfirmasi”) = vbYes Then
Unload Me
Load Me
Form1.Show
End If
End If
End Sub
Private Sub Label12_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label12.ForeColor = &H0&
Label12.BackStyle = 1
Label12.BackColor = &H80FFFF
Label12.BorderStyle = 1
End Sub
Private Sub Timer1_Timer()
kata = Right(kata, Len(kata) – 1) & Left(kata, 1)
Label7.Caption = kata
End Sub
Private Sub XpBs1_Click(Index As Integer)
On Error Resume Next
With DE.rsp_siswa
Select Case Index
Case 0
.MoveFirst
MsgBox “Data Awal”
Case 1
If .AbsolutePosition > 1 Then .MovePrevious
If .AbsolutePosition = 1 Then MsgBox “Data Awal”
Case 2
If .AbsolutePosition < .RecordCount Then .MoveNext
If .AbsolutePosition = .RecordCount Then MsgBox “Data Ahir”
Case 3
.MoveLast
MsgBox “Data Ahir”
End Select
End With
End Sub
Private Sub XpBs2_Click()
If MsgBox(“Apakah Anda Yakin ?”, vbYesNo + vbQuestion, “Konfirmasi”) = vbYes Then
If baru = True Then
strSQL = “INSERT INTO t_swa_baru(no_dftr,jns_pdftran,nm_swa,tmpt_lhr,tgl_lhr,jns_kel,agm,alamat,telp_sw,kd_possw,kat_skolah,” & _
“nm_skolah,alamat_skolah,telp_sk,kd_possk,nm_a,pkrjaan_a,pnddkan_a,pnghsilan_a,nm_i,penddikan_i,pnghsilan_i,almat_or,telp,hp_or,kd_pos)” & _
“VALUES(‘” & txt_no.Text & “‘,’” & t_jalur.Text & “‘,’” & t_nama.Text & “‘,’” & t_tlhr.Text & “‘,’” & t_tglhr.Value & “‘,” & _
“‘” & t_jk.Text & “‘,’” & t_agm.Text & “‘,’” & t_almt1.Text & “‘,’” & t_tlp1.Text & “‘,’” & t_kdp1.Text & “‘,’” & t_kats.Text & “‘,” & _
“‘” & t_nm_sek.Text & “‘,’” & t_almt2.Text & “‘,’” & t_tlp2.Text & “‘,’” & t_kdp2.Text & “‘,’” & t_ay.Text & “‘,’” & t_pkay.Text & “‘,’” & t_pday.Text & “‘,” & _
“‘” & t_phay.Text & “‘,’” & t_ib.Text & “‘,’” & t_pdib.Text & “‘,’” & t_phib.Text & “‘,’” & t_almt3.Text & “‘,’” & t_tlp3.Text & “‘,’” & t_hp.Text & “‘,” & _
“‘” & t_kdp3.Text & “‘)”
DE.mCon.Execute strSQL
ElseIf baru = False Then
strSQL = “UPDATE t_swa_baru SET jns_pdftran=’” & t_jalur.Text & “‘,nm_swa=’” & t_nama.Text & “‘,” & _
“tmpt_lhr=’” & t_tlhr.Text & “‘,tgl_lhr=’” & t_tglhr.Value & “‘,jns_kel=’” & t_jk.Text & “‘,agm=’” & t_agm.Text & “‘,alamat=’” & t_almt1.Text & “‘,” & _
“telp_sw=’” & t_tlp1.Text & “‘,kd_possw=’” & t_kdp1.Text & “‘,kat_skolah=’” & t_kats.Text & “‘,nm_skolah=’” & t_nm_sek.Text & “‘,alamat_skolah=’” & t_almt2.Text & “‘,” & _
“telp_sk=’” & t_tlp2.Text & “‘,kd_possk=’” & t_kdp2.Text & “‘,nm_a=’” & t_ay.Text & “‘,pkrjaan_a=’” & t_pkay.Text & “‘,pnddkan_a=’” & t_pday.Text & “‘,” & _
“pnghsilan_a=’” & t_phay.Text & “‘,nm_i=’” & t_ib.Text & “‘,penddikan_i=’” & t_pdib.Text & “‘,pnghsilan_i=’” & t_phib.Text & “‘,almat_or=’” & t_almt3.Text & “‘,” & _
“telp=’” & t_tlp3.Text & “‘,hp_or=’” & t_hp.Text & “‘,kd_pos=’” & t_kdp3.Text & “‘ WHERE no_dftr=’” & txt_no.Text & “‘”
DE.mCon.Execute strSQL
End If
DE.rsp_siswa.MoveFirst
Frame1.Visible = False
DE.rsp_siswa.Close
If DE.rsp_siswa.State = 0 Then DE.rsp_siswa.Open
If MsgBox(“Data Tersimpan Refresh Data Base ?”, vbInformation + vbYesNo, “Konfirmasi”) = vbYes Then
Unload Me
Load Me
Form1.Show
End If
End If
End Sub
Private Sub XpBs3_Click()
Frame1.Visible = False
End Sub
6. Lalu jalankan dah…
sourch code dapat di download
di sinidan semoga bermanfaat….