TUGAS TA BELAJAR BAHASA PEMOGRAMAN
Desain menu utam:
Listing program menu utama:
Public Class Form1
Private Sub DataBarangToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
DataBarangToolStripMenuItem.Click
DATA_BARRANG.Show()
End Sub
Private Sub KELUARToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KELUARToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub DataSupplierToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
DataSupplierToolStripMenuItem.Click
data_supplier.Show()
End Sub
Private Sub DataPegawaiToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles DataPegawaiToolStripMenuItem.Click
data_pegawai.Show()
End Sub
Private Sub DataPetugasGudangToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
DataPetugasGudangToolStripMenuItem.Click
data_petugas_gudang.Show()
End Sub
Private Sub DataPersedianToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
DataPersedianToolStripMenuItem.Click
data_persedian.Show()
End Sub
Private Sub LaporanBarangToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LaporanBarangToolStripMenuItem.Click
Form2.Show()
Dim
laporan As New
CrystalReport2
Form2.CrystalReportViewer1.ReportSource
= laporan
End Sub
Private Sub LaporanPegawaiToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LaporanPegawaiToolStripMenuItem.Click
Form6.Show()
Dim
laporan As New
CrystalReport5
Form6.CrystalReportViewer1.ReportSource
= laporan
Form6.MdiParent = Me
End Sub
Private Sub LaporanPetugasGudangToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LaporanPetugasGudangToolStripMenuItem.Click
Form5.Show()
Dim
laporan As New
CrystalReport6
Form5.CrystalReportViewer1.ReportSource
= laporan
Form5.MdiParent = Me
End Sub
Private Sub LaporanPersedianToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LaporanPersedianToolStripMenuItem.Click
Form7.Show()
Dim
laporan As New
CrystalReport7
Form7.CrystalReportViewer1.ReportSource
= laporan
Form7.MdiParent = Me
End Sub
Private Sub LaporanSupplierToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LaporanSupplierToolStripMenuItem.Click
Form4.Show()
Dim
laporan As New
CrystalReport4
Form4.CrystalReportViewer1.ReportSource
= laporan
Form4.MdiParent = Me
End Sub
End Class
Hasil menu utama:
Desain data barrang:
Listing program data barrang:
Imports
System.Data.OleDb
Public Class DATA_BARRANG
Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OPENDB()
Dim
LOKASI = "Provider =
Microsoft.Jet.OLEDB.4.0;Data Source=C:\vb5\penjualan1.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
Recordanggota()
ADP = New
OleDbDataAdapter("SELECT * FROM
databarang", DB)
DS = New
DataSet
ADP.Fill(DS, "databarang")
DataGridView1.DataSource = DS.Tables("databarang")
End Sub
Sub
butoonbaru()
Btn_baru.Enabled = True
Btn_simpan.Enabled = False
Btn_edit.Enabled = False
Btn_hapus.Enabled = False
Btn_batal.Enabled = False
Btn_keluar.Enabled = True
End Sub
Sub
butoonedit()
Btn_baru.Enabled = False
Btn_simpan.Enabled = False
Btn_edit.Enabled = True
Btn_hapus.Enabled = True
Btn_batal.Enabled = True
Btn_keluar.Enabled = False
End Sub
Sub
butoonsimpan()
Btn_baru.Enabled = False
Btn_simpan.Enabled = True
Btn_edit.Enabled = False
Btn_hapus.Enabled = False
Btn_batal.Enabled = True
Btn_keluar.Enabled = False
End Sub
Sub
hapustext()
kode.Text = ""
nama.Text = ""
spesifikasi.Text = ""
Call
butoonbaru()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
hapustext()
Call
Recordanggota()
Call
butoonsimpan()
spesifikasi.Items.Add("2")
spesifikasi.Items.Add("4")
spesifikasi.Items.Add("8")
End Sub
Private Sub HPS_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_hapus.Click
SQL = "DELETE
FROM LATIHAN Where KODE='" & kode.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub BR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_baru.Click
Call
hapustext()
kode.Focus()
End Sub
Private Sub KLR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_keluar.Click
Me.Close()
End Sub
Private Sub NO_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
btn_keluar.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM LATIHAN Where KODE='" & kode.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
nama.Text = DR.Item(1)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = kode.Text
Call
hapustext()
kode.Text = xkode
Call
butoonsimpan()
End
If
nama.Focus()
End If
End Sub
Private Sub BTL_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_batal.Click
Call
hapustext()
kode.Focus()
End Sub
Private Sub DIT_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btn_edit.Click
SQL = "UPDATE
LATIHAN SET NAMA='" & nama.Text & "',"
& _
"SPESIFIKASI='" & spesifikasi.Text
& "'," & _
"Where KODE='" & kode.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub SMPN_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btn_simpan.Click
SQL = "INSERT
INTO LATIHAN (kode, nama,spesifikasi)" & _
"Values ('" & kode.Text & "','" & _
nama.Text & "','" &
_
spesifikasi.Text & "','"
CMD = New
OleDbCommand(SQL, DB)
5: CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
Recordanggota()
End Sub
Private Sub spesipikasi_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
spesifikasi.SelectedIndexChanged
spesifikasi.Items.Clear()
If
spesifikasi.Text = "sabun" Then
spesifikasi.Items.Add("komputer")
spesifikasi.Items.Add("cosmos")
End If
If
spesifikasi.Text = "2" Then
spesifikasi.Items.Add("4")
spesifikasi.Items.Add("8")
End If
End Sub
End Class
Hasil data barrang:
Hasil laporan data barrang: