DISKRIPSI LATIHAN 28 B
Latihan_28B_36110030
A.
Object-object dalam Latihan_28B_36110030 :
1. Object Label
Terdapat lima
label (yang bertuliskan penginputan barang, kode barang, nama barang, harga
jual, dan jumlah barang).
2. Object
Button
Terdapat
satu object button (Simpan) yang digunakan untuk menyimpan data yang telah
diinput pada textbox ke dalam form BARANG di Ms Access, atau bisa juga diliat
hasilnya pada datagridview pada form Latihan_28A_36110030.
3. Object
TextBox
Terdapat
empat obejct textbox yang digunakan untuk menampilkan kode barang, nama barang,
harga jual, dan jumlah barang dari daftar barang yang dipilih pada form
Latihan_28A_36110030.
B.
Script Unique
Untuk
script, dapat dilihat secara menyeluruh pada Prosedur Penyelesaian Latihan_28B_36110030.
C.
Even
SIMPAN_36110030_Click
PROSEDUR PENYELESAIAN LATIHAN 28 B
1.KLIK STAR KEMUDIAN PILIH
MICROSOFT VISUAL STUDIA 2008
2.KEMUDIAN
KLIK NEW PROJECT PADA FILE
3.KEMUDIAN KLIK ADD UNTUK MENAMBAHKAN PROJECT
4. KEMUDIAN BUATLAH FORM SEPERTI DIBAWAH INI :
5.KEMUDIAN MASUKAN RUMUS :
Public Class Latihan_28b_36110030
Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =E:\semester 5\Apkom 4\LATIHAN 27-34 SIMPAN EDIT DELETE DATA\databarang.accdb;jet oledb:database password=hma")
Private Sub simpan_36110030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_36110030.Click
'perintah periksa data
If KB_36110030.Text.Length = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If NB_36110030.Text.Length = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If Val(HJ_36110030.Text) = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If Val(JB_36110030.Text) = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
'perintah ambil data
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", KB_36110030.Text, 1, go)
If PENCARI.JumlanBaris > 0 Then
MsgBox("The data has been exist please insert new data")
'mengosongkan text box
KB_36110030.Text = " "
NB_36110030.Text = " "
HJ_36110030.Text = " "
JB_36110030.Text = " "
Exit Sub
End If
'deklarasi object command
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_36110030.Text & "','" & NB_36110030.Text & "', " & Val(HJ_36110030.Text) & "," & Val(JB_36110030.Text) & ")", go)
go.Open()
Cm.ExecuteNonQuery()
go.Close()
Cm.Dispose()
'mengosongkan text box
KB_36110030.Text = " "
NB_36110030.Text = " "
HJ_36110030.Text = " "
JB_36110030.Text = " "
'menjalankan procedure pengambilan data
latihan_28A_36110030.ambildata()
'menutup form
Me.Close()
End Sub
End Class
Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =E:\semester 5\Apkom 4\LATIHAN 27-34 SIMPAN EDIT DELETE DATA\databarang.accdb;jet oledb:database password=hma")
Private Sub simpan_36110030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_36110030.Click
'perintah periksa data
If KB_36110030.Text.Length = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If NB_36110030.Text.Length = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If Val(HJ_36110030.Text) = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If Val(JB_36110030.Text) = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
'perintah ambil data
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", KB_36110030.Text, 1, go)
If PENCARI.JumlanBaris > 0 Then
MsgBox("The data has been exist please insert new data")
'mengosongkan text box
KB_36110030.Text = " "
NB_36110030.Text = " "
HJ_36110030.Text = " "
JB_36110030.Text = " "
Exit Sub
End If
'deklarasi object command
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_36110030.Text & "','" & NB_36110030.Text & "', " & Val(HJ_36110030.Text) & "," & Val(JB_36110030.Text) & ")", go)
go.Open()
Cm.ExecuteNonQuery()
go.Close()
Cm.Dispose()
'mengosongkan text box
KB_36110030.Text = " "
NB_36110030.Text = " "
HJ_36110030.Text = " "
JB_36110030.Text = " "
'menjalankan procedure pengambilan data
latihan_28A_36110030.ambildata()
'menutup form
Me.Close()
End Sub
End Class
6. KEMUDIAN
UJI PROGRAM
7. JIKA SUDAH BERHASIL
Save program anda
8. SELESAI
0 komentar:
Posting Komentar