Penjualan barang
design
Public Class Form2
Private Sub btnkeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnkeluar.Click
no_pmbeli.Text = ""
kd_brg.Text = ""
nm_brg.Text = ""
merk.Text = ""
harga.Text = ""
jmlh_beli.Text = ""
total_hrg.Text = ""
End Sub
Sub
buatTable()
LV.Columns.Add("no
pembelian", 80, HorizontalAlignment.Center)
LV.Columns.Add("kode
barang", 60, HorizontalAlignment.Left)
LV.Columns.Add("nama
baarang", 60, HorizontalAlignment.Left)
LV.Columns.Add("merk",
60, HorizontalAlignment.Left)
LV.Columns.Add("harga",
60, HorizontalAlignment.Left)
LV.Columns.Add("jumlah
beli", 60, HorizontalAlignment.Left)
LV.Columns.Add("total
harga", 60, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub
isiTable()
Dim lst
As New
ListViewItem
lst.Text = no_pmbeli.Text
lst.SubItems.Add(kd_brg.Text)
lst.SubItems.Add(nm_brg.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jmlh_beli.Text)
lst.SubItems.Add(total_hrg.Text)
LV.Items.Add(lst)
End Sub
Private Sub btnsimpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnsimpan.Click
isiTable()
no_pmbeli.Text = ""
kd_brg.Text = ""
nm_brg.Text = ""
merk.Text = ""
harga.Text = ""
jmlh_beli.Text = ""
total_hrg.Text = ""
End Sub
Private Sub kd_brg_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
kd_brg.SelectedIndexChanged
Dim a As String
a =
Microsoft.VisualBasic.Left(kd_brg.Text, 2)
Select Case a
Case
"ts" : merk.Text = "thosiba"
Case
"vg" : merk.Text = "v-gen"
End Select
Dim a2 As String
a2 =
Microsoft.VisualBasic.Right(kd_brg.Text, 3)
Select Case a2
Case
"001" : nm_brg.Text = "flashdisk 4 gb"
Case
"002" : nm_brg.Text = "flashdisk 2 gb"
End Select
If a = "ts" And
a2 = "001" Then
harga.Text = 10500
ElseIf
a = "ts" And
a2 = "002" Then
harga.Text = 75000
ElseIf
a = "vg" And
a2 = "001" Then
harga.Text = 90000
ElseIf
a = "vg" And
a2 = "002" Then
harga.Text = 60000
End If
End Sub
Private Sub btnhapussemua_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnhapussemua.Click
LV.Items.Clear()
End Sub
Private Sub btnhapusdata_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnhapusdata.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub jmlh_beli_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
jmlh_beli.KeyPress
If
e.KeyChar = Chr(13) Then
total_hrg.Text = harga.Text *
jmlh_beli.Text
End If
End Sub
Private Sub jmlh_beli_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles jmlh_beli.TextChanged
End Sub
Private Sub Form2_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
kd_brg.Items.Add("ts001")
kd_brg.Items.Add("ts002")
kd_brg.Items.Add("vg001")
kd_brg.Items.Add("vg002")
buatTable()
End Sub
End Class
Hasilnya
Demikianlah Postingan Saya
Nama:ema-satriana-karo
Npm:1111207
Selamat Belajar Pemograman VB.net
Tidak ada komentar:
Posting Komentar