1 / 16

Pertemuan ke 1

Pertemuan ke 1. Review Pemrograman Visual I. Software yang digunakan dalam mata kuliah Pemrograman Visual Basic II, antara lain : Visual Basic 6.0 Apache2triad MySQL Connector ODBC 3.51 atau 5.1 Crystal Report 7.0 atau 8.0. Review Pemrograman Visual Basic I

gema
Download Presentation

Pertemuan ke 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pertemuan ke 1 Review Pemrograman Visual I

  2. Software yang digunakan dalam mata kuliah Pemrograman Visual Basic II, antara lain : • Visual Basic 6.0 • Apache2triad • MySQL Connector ODBC 3.51 atau 5.1 • Crystal Report 7.0 atau 8.0

  3. Review Pemrograman Visual Basic I • Buatlah database baru dengan nama dbKursus • Buatlah tabel baru dengan nama Siswa dengan mengunakan VisData

  4. Design form berikut dan beri nama (Project : PrjReview dan Form : FrmKursus)

  5. Design form berikut dan beri nama (Project : PrjReview dan Form : FrmKursus) • Buatlah prosedur dengan nama AKTIF, NONAKTIF, BERSIH dan TAMPIL • NIS tampil secara otomatis. Terdiri dari 7 digit.4 Digit pertama berdasarkan tahun sistem dan 3 digit terakhir sesuai dengan no urut. • Pada saat Form dijalankan, semua objek dalam keadaan NONAKTIF dan hanya tombol ADD saja yang aktif • Tombol ADD diklik maka tombol CANCEL dan SAVE aktif • Saat tombol FIND diklik mucul INPUTBOX untuk melakukan pencarian berdasarkan NIS lalu tombol DELETE dan EDIT aktif

  6. Coding : Sub nonaktif() tnis.Enabled = False tnama.Enabled = False talamat.Enabled = False opperempuan.Enabled = False oplaki.Enabled = False cmbagama.Enabled = False End Sub Sub aktif() tnama.Enabled = True talamat.Enabled = True opperempuan.Enabled = True oplaki.Enabled = True cmbagama.Enabled = True End Sub

  7. Sub nomat() With DtSiswa If .Recordset.EOF Then x = Right(Date, 4) + "001" tnis.Text = x Else .Recordset.MoveLast z = Right(.Recordset!NIS, 3) + 1 x = (Right(Date, 4)) + Right("000" & z, 3) tnis.Text = x End If End With End Sub

  8. Sub bersih() tnama.Text = "" talamat.Text = "" opperempuan.Value = False oplaki.Value = False cmbagama.Text = "" End Sub Private Sub cmdadd_Click() nomat aktif bersih tnama.SetFocus cmdadd.Enabled = False cmdcancel.Enabled = True cmdsave.Enabled = True End Sub

  9. Sub tampil() On Error Resume Next With DtSiswa.Recordset tnis.Text = !NIS tnama.Text = !Nama talamat.Text = !Alamat If !Jkel = "P" Then opperempuan.Value = True Else oplaki.Value = True End If cmbagama.Text = !Agama End With DtSiswa.Refresh End Sub

  10. Private Sub cmdcancel_Click() bersih nonaktif cmdadd.Enabled = True cmdcancel.Enabled = False cmdsave.Enabled = False End Sub Private Sub cmdfirst_Click() DtSiswa.Recordset.MoveFirst tampil End Sub Private Sub cmdlast_Click() DtSiswa.Recordset.MoveLast tampil End Sub

  11. Private Sub cmddelete_Click() x = MsgBox("Yakin Data akan di Hapus?", vbQuestion + vbOKCancel, "Konfirmasi") If x = vbOK Then DtSiswa.Recordset.Delete DtSiswa.Recordset.MoveFirst DtSiswa.Refresh End If cmdedit.Enabled = False cmddelete.Enabled = False End Sub

  12. Private Sub cmdedit_Click() If cmdedit.Caption = "&EDIT" Then aktif cmdedit.Caption = "&UPDATE" Else If cmdedit.Caption = "&UPDATE" Then With DtSiswa.Recordset .Edit !NIS = tnis.Text !Nama = tnama.Text !Alamat = talamat.Text If opperempuan.Value = True Then !Jkel = "P" Else !Jkel = "L" End If !Agama = cmbagama.Text .Update End With bersih nonaktif cmdedit.Caption = "&EDIT" cmdedit.Enabled = False cmddelete.Enabled = False End If End If End Sub

  13. Private Sub cmdfind_Click() cari = InputBox("Masukkan NIS", "Cari Data") If cari <> Empty Then DtSiswa.Recordset.Index = "IdxNIS" DtSiswa.Recordset.Seek "=", cari If Not DtSiswa.Recordset.NoMatch Then nonaktif cmdedit.Enabled = True cmddelete.Enabled = True cmdcancel.Enabled = False cmdsave.Enabled = False tampil Else MsgBox "NIS Tidak Ditemukan", vbCritical, "Informasi" cari = "" End If End If End Sub

  14. Private Sub cmdnext_Click() DtSiswa.Recordset.MoveNext If DtSiswa.Recordset.EOF Then MsgBox "Sudah di Akhir Record", vbCritical, "Info" DtSiswa.Recordset.MoveLast End If tampil End Sub Private Sub cmdprev_Click() DtSiswa.Recordset.MovePrevious If DtSiswa.Recordset.BOF Then MsgBox "Sudah di Awal Record", vbCritical, "Info" DtSiswa.Recordset.MoveFirst End If tampil End Sub

  15. Private Sub cmdquit_Click() End End Sub Private Sub cmdsave_Click() With DtSiswa.Recordset .AddNew !NIS = tnis.Text !Nama = tnama.Text !Alamat = talamat.Text If opperempuan.Value = True Then !Jkel = "P" Else !Jkel = "L" End If !Agama = cmbagama.Text .Update End With bersih nonaktif cmdsave.Enabled = False cmdcancel.Enabled = False cmdadd.Enabled = True End Sub

  16. Private Sub Form_Activate() nonaktif tampil cmdcancel.Enabled = False cmdsave.Enabled = False cmddelete.Enabled = False cmdedit.Enabled = False End Sub Private Sub Timer1_Timer() twaktu.Text = Time End Sub

More Related