0% found this document useful (0 votes)
26 views5 pages

Modul Pertemuan 1: Modul Database 3 Akn Trenggalek

This document contains code for a simple bookstore program created in Visual Basic 6. It includes the design of the user interface with labels and text boxes. The code defines procedures for adding, deleting, saving, and navigating records in a database table using ADO connections and recordsets. It also includes procedures for clearing fields and refreshing the display after changes are made.

Uploaded by

dwi fatmawati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views5 pages

Modul Pertemuan 1: Modul Database 3 Akn Trenggalek

This document contains code for a simple bookstore program created in Visual Basic 6. It includes the design of the user interface with labels and text boxes. The code defines procedures for adding, deleting, saving, and navigating records in a database table using ADO connections and recordsets. It also includes procedures for clearing fields and refreshing the display after changes are made.

Uploaded by

dwi fatmawati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MODUL DATABASE 3 AKN TRENGGALEK

MODUL PERTEMUAN 1

KOMPONEN PROPERTIES NILAI


Form caption PROGRAM BENLANJA SEDERHANA
Label1 caption PROGRAM BENLANJA SEDERHANA
Label2 caption Nama Barang
Label3 caption Harga Satuan
Label4 caption Jumlah Barang
Label5 caption Total Harga
Label6 caption Diskon
Label7 caption Total Bayar
Label8 caption Bonus
Textbox1 (name) Txtnamabrg
text (kosong)
Textbox2 (name) txttotal
text (kosong)
Textbox3 (name) txtdiskon
text (kosong)
Textbox4 (name) txttotalbyr
text (kosong)
Textbox5 (name) txtbonus
text (kosong)
CommandButton1 (name) cmdhitung
caption Hitung
CommandButton1 (name) cmdulang
caption Ulang
CommandButton1 (name) cmdkeluar
caption Keluar

Pertemuan 1 : Penggunaan Variabel, tipe data pada pemrograman visual (VB 6)


MODUL DATABASE 3 AKN TRENGGALEK

Code :
Private Sub cmdhitung_Click()
Dim harga, jumlah As Integer
Dim total, diskon, bayar As Double
Dim bonus As String

harga = txthargasat.Text
jumlah = txtjumbrg.Text
total = harga * jumlah

If total >= 500000 Then


diskon = 0.2 * total
bonus = "Tas Pinggang"
ElseIf total >= 200000 Then
diskon = 0.15 * total
bonus = "Payung"
ElseIf total >= 100000 Then
diskon = 0.1 * total
bonus = "Kaos"
ElseIf total >= 50000 Then
diskon = 0.05 * total
bonus = "Payung kecil"

Else
diskon = 0
bonus = " Tidak Ada"

End If

bayar = total - diskon


txttotal.Text = total
txtdiskon.Text = diskon
txttotalbyr.Text = bayar
txtbonus.Text = bonus

End Sub

Private Sub cmdkeluar_Click()


Unload Me
End Sub

Private Sub cmdulang_Click()


txtnamabrg.Text = ""
txthargasat.Text = ""
txtjumbrg.Text = ""
txttotal.Text = ""
txtdiskon.Text = ""
txttotalbyr.Text = ""
txtbonus.Text = ""
txtnamabrg.SetFocus
End Sub

Pertemuan 1 : Penggunaan Variabel, tipe data pada pemrograman visual (VB 6)


MODUL DATABASE 3 AKN TRENGGALEK
PROJECT 2

KOMPONEN PROPERTIES NILAI


Form caption PROGRAM BENLANJA SEDERHANA
Label1 caption DATA BUKU
Label2 caption KODE
Label3 caption NAMA BUKU
Label4 caption HARGA
Textbox1 (name) Txt_kode
text (kosong)
Textbox2 (name) Txt_namabk
text (kosong)
Textbox3 (name) txtharga
text (kosong)
CommandButton1 (name) Cmd_baru
caption BARU
CommandButton2 (name) Cmd_simpan
caption SIMPAN
CommandButton3 (name) Cmd_hapus
caption HAPUS
CommandButton3 (name) Cmd_hapus
caption HAPUS
CommandButton4 (name) Cmd_keluar
caption
CommandButton5 (name) Cmd_hapus
caption HAPUS
CommandButton6 (name) Cmd_top
caption
CommandButton7 (name) Cmd_previous
caption
CommandButton8 (name) Cmd_next

Pertemuan 1 : Penggunaan Variabel, tipe data pada pemrograman visual (VB 6)


MODUL DATABASE 3 AKN TRENGGALEK
caption
CommandButton9 (name) Cmd_bottom
caption
DataGrid1
Adodc1 Properties Connection setting : Provider jet 4.0
OLE DB
Recordsource Commandtype : table
Table : Buku
DBase Visual Access 7.0
Datamanager

Source

Sub bersih()
txt_kode.Text = ""
txt_namabk.Text = ""
txt_harga.Text = ""
End Sub

Private Sub cmd_baru_Click()


Adodc1.Recordset.AddNew
bersih
DataGrid1.Refresh
txt_kode.SetFocus
End Sub

Private Sub cmd_bottom_Click()


Adodc1.Recordset.MoveLast
MsgBox "AKHIR RECORD", , "INFO"
End Sub

Private Sub cmd_hapus_Click()


a = MsgBox("Yakin Hapus Data", vbYesNo, "PERINGATAN!!!")
If a = vbYes Then
Adodc1.Recordset.Delete
End If
End Sub

Private Sub cmd_keluar_Click()


a = MsgBox("Anda Yakin Keluar Program", vbYesNo, "Peringatan!!!")
If a = vbYes Then
Unload Me
End If
End Sub

Private Sub cmd_next_Click()


With Adodc1.Recordset
.MoveNext
If .EOF Then
MsgBox "SUDAH AKHIR RECORD", , "INFO"
.MoveLast
End If

Pertemuan 1 : Penggunaan Variabel, tipe data pada pemrograman visual (VB 6)


MODUL DATABASE 3 AKN TRENGGALEK
End With
End Sub

Private Sub cmd_previous_Click()


Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
MsgBox "SUDAH AWAL RECORD", , "INFO"
Adodc1.Recordset.MoveFirst
End If
End Sub

Private Sub cmd_simpan_Click()


Adodc1.Recordset.Update
End Sub

Private Sub cmd_top_Click()


Adodc1.Recordset.MoveFirst
MsgBox "AWAL RECORD", , "INFO"
End Sub

Pertemuan 1 : Penggunaan Variabel, tipe data pada pemrograman visual (VB 6)

You might also like