Sistem Informasi Penjualan dengan VBNET
Koding :
Public Class Form1
Sub RancangTabel()
With LV
.Columns.Add("Kode", 90, HorizontalAlignment.Center)
.Columns.Add("Nama Binkai", 120, HorizontalAlignment.Center)
.Columns.Add("Harga", 100, HorizontalAlignment.Center)
.Columns.Add("Jumlah", 50, HorizontalAlignment.Center)
.Columns.Add("Total", 80, HorizontalAlignment.Center)
.GridLines = True
.FullRowSelect = True
.View = View.Details
End With
End Sub
Sub MasukTabel()
Dim bisa As New ListViewItem
With bisa
.Text = kode.Text
.SubItems.Add(kode.Text)
.SubItems.Add(harga.Text)
.SubItems.Add(jumlah.Text)
.SubItems.Add(total.Text)
LV.Items.Add(bisa)
End With
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kode.Items.Add("001")
kode.Items.Add("002")
kode.Items.Add("003")
RancangTabel()
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
If kode.Text = "001" Then
nama.Text = "Bingkai Besar"
harga.Text = 15000
ElseIf kode.Text = "002" Then
nama.Text = "Sedang"
harga.Text = 10000
Else
nama.Text = "Bingkai Kecil"
harga.Text = 5000
End If
End Sub
Private Sub proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles proses.Click
total.Text = harga.Text * jumlah.Text
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
kode.Text = ""
nama.Text = ""
harga.Text = ""
jumlah.Text = ""
total.Text = ""
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
MasukTabel()
End Sub
Private Sub hps_1_lst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps_1_lst.Click
If LV.SelectedItems.Count <> 0 Then
LV.Items.Remove(LV.SelectedItems(0))
Else
MsgBox("Pilih Dulu yang mau dihapus")
End If
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
End
End Sub
End Class
Public Class Form1
Sub RancangTabel()
With LV
.Columns.Add("Kode", 90, HorizontalAlignment.Center)
.Columns.Add("Nama Binkai", 120, HorizontalAlignment.Center)
.Columns.Add("Harga", 100, HorizontalAlignment.Center)
.Columns.Add("Jumlah", 50, HorizontalAlignment.Center)
.Columns.Add("Total", 80, HorizontalAlignment.Center)
.GridLines = True
.FullRowSelect = True
.View = View.Details
End With
End Sub
Sub MasukTabel()
Dim bisa As New ListViewItem
With bisa
.Text = kode.Text
.SubItems.Add(kode.Text)
.SubItems.Add(harga.Text)
.SubItems.Add(jumlah.Text)
.SubItems.Add(total.Text)
LV.Items.Add(bisa)
End With
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kode.Items.Add("001")
kode.Items.Add("002")
kode.Items.Add("003")
RancangTabel()
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
If kode.Text = "001" Then
nama.Text = "Bingkai Besar"
harga.Text = 15000
ElseIf kode.Text = "002" Then
nama.Text = "Sedang"
harga.Text = 10000
Else
nama.Text = "Bingkai Kecil"
harga.Text = 5000
End If
End Sub
Private Sub proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles proses.Click
total.Text = harga.Text * jumlah.Text
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
kode.Text = ""
nama.Text = ""
harga.Text = ""
jumlah.Text = ""
total.Text = ""
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
MasukTabel()
End Sub
Private Sub hps_1_lst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps_1_lst.Click
If LV.SelectedItems.Count <> 0 Then
LV.Items.Remove(LV.SelectedItems(0))
Else
MsgBox("Pilih Dulu yang mau dihapus")
End If
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
End
End Sub
End Class