Minggu, 06 September 2015

Program VB Daftar Barang

100% Working Dijamin ....

Pict :

Codingnya :

Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields!Kode_Barang = Text1.Text
Adodc1.Recordset.Fields!Nama_Barang = Text2.Text
If Combo1.ListIndex = 0 Then Adodc1.Recordset.Fields!Jenis_Barang = "Elektronik"
If Combo1.ListIndex = 1 Then Adodc1.Recordset.Fields!Jenis_Barang = "Gadget"
If Combo1.ListIndex = 2 Then Adodc1.Recordset.Fields!Jenis_Barang = "Rumah Tangga"
If Combo1.ListIndex = 3 Then Adodc1.Recordset.Fields!Jenis_Barang = "Buku dan Majalah"
If Combo1.ListIndex = 4 Then Adodc1.Recordset.Fields!Jenis_Barang = "Peralatan Kantor"
Adodc1.Recordset.Fields!Banyak_Barang = Text3.Text
Adodc1.Recordset.Fields!Harga_Satuan = Text4.Text
Adodc1.Recordset.Update
Adodc1.Refresh
Text1 = " "
Text2 = " "
Text3 = " "
Text4 = " "
End Sub

Private Sub Command2_Click()
x = MsgBox("Anda Ingin Keluar? Jangan Lupa di Simpan Datanya!", vbQuestion + vbOKCancel, "Konfirmasi")
If x = vbOK Then
End
End If
End Sub
Private Sub Command3_Click()
Adodc1.Recordset!Kode_Barang = Text1.Text
Adodc1.Recordset.Fields!Nama_Barang = Text2.Text
If Combo1.ListIndex = 0 Then Adodc1.Recordset.Fields!Jenis_Barang = "Elektronik"
If Combo1.ListIndex = 1 Then Adodc1.Recordset.Fields!Jenis_Barang = "Gadget"
If Combo1.ListIndex = 2 Then Adodc1.Recordset.Fields!Jenis_Barang = "Rumah Tangga"
If Combo1.ListIndex = 3 Then Adodc1.Recordset.Fields!Jenis_Barang = "Buku dan Majalah"
If Combo1.ListIndex = 4 Then Adodc1.Recordset.Fields!Jenis_Barang = "Peralatan Kantor"
Adodc1.Recordset.Fields!Banyak_Barang = Text3.Text
Adodc1.Recordset.Fields!Harga_Satuan = Text4.Text
Adodc1.Recordset.Update
Adodc1.Refresh
Text1 = " "
Text2 = " "
Text3 = " "
Text4 = " "
End Sub

Private Sub Command4_Click()
x = MsgBox("Apakah anda ingin menghapus datanya?", vbQuestion + vbYesNo, "Perhatian !")
If x = vbYes Then
If Adodc1.Recordset.RecordCount = 0 Then
Else
Adodc1.Recordset.Delete
End If
End If
End Sub

Private Sub Command5_Click()
Adodc1.Recordset.Find "Kode_Barang= '" + Text5.Text + "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
Text5.Text = Adodc1.Recordset!Kode_Barang
Else
MsgBox "Maaf, Data yg anda cari Tidak Ditemukan!"
End If
End Sub

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

Private Sub Command7_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
End If
End Sub

Private Sub Command8_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
End If
End Sub

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

Private Sub Form_Load()
Combo1.AddItem "Elektronik"
Combo1.AddItem "Gadget"
Combo1.AddItem "Rumah Tangga"
Combo1.AddItem "Buku dan Majalah"
Combo1.AddItem "Peralatan Kantor"
End Sub

1 komentar:

Pasek Tohpati mengatakan...

Kang aku pengin blajar VB,, mulai dari mana sebaiknya ?
utamanya MySQL unt databasenya. bantuin dong ! thanks

Posting Komentar

 
;