Home » » Materi Visual Basic Membuat Form

Materi Visual Basic Membuat Form

Written By Unknown on Sunday, 3 February 2013 | 18:46

Contoh Pembuatan Form 

Listing Program

Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset!Kode_buku = txtkodebuku.Text
Adodc1.Recordset!judul_buku = txtjudulbuku.Text
Adodc1.Recordset!pengarang = txtpengarang.Text
Adodc1.Recordset!penerbit = txtpenerbit.Text
Adodc1.Recordset!jumlah_buku = txtjumlahbuku.Text
Adodc1.Recordset.Update
MsgBox "Data sudah disimpan"
Adodc1.Refresh
End Sub

Private Sub Command2_Click()
Adodc1.Recordset!Kode_buku = txtkodebuku.Text
Adodc1.Recordset!judul_buku = txtjudulbuku.Text
Adodc1.Recordset!pengarang = txtpengarang.Text
Adodc1.Recordset!penerbit = txtpenerbit.Text
Adodc1.Recordset!jumlah_buku = txtjumlahbuku.Text
Adodc1.Recordset.Update
MsgBox "Data sudah diubah"
End Sub

Private Sub Command3_Click()
Adodc1.Recordset.Delete
txtkodebuku.Text = ""
txtjudulbuku.Text = ""
txtpengarang.Text = ""
txtpenerbit.Text = ""
txtjumlahbuku.Text = ""
MsgBox "Data sudah dihapus"
Adodc1.Refresh
End Sub

Private Sub Command4_Click()
Adodc1.Recordset.MoveFirst
End Sub

Private Sub Command5_Click()
Adodc1.Recordset.MovePrevious
End Sub

Private Sub Command6_Click()
Adodc1.Recordset.MoveNext
End Sub

Private Sub Command7_Click()
Adodc1.Recordset.MoveLast
End Sub

Private Sub DataGrid1_Click()
txtkodebuku = Adodc1.Recordset!Kode_buku
txtjudulbuku = Adodc1.Recordset!judul_buku
txtpengarang = Adodc1.Recordset!pengarang
txtpenerbit = Adodc1.Recordset!penerbit
txtjumlahbuku = Adodc1.Recordset!jumlah_buku
End Sub

Menggunakan database dengan Tabel data buku dengan field sebagai berikut :
1. kode_buku
2. judul_buku
3. pengarang
4. penerbit
5. Jumlah_buku
Share this post :

Post a Comment

 
Support : Creating Website | Portal-jarkom Template | Portal-Jarkom Template
Copyright © 2011. Belajar IT Lebih Mudah - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger