Listing Programnya :
Public Class Form1
Sub Buattabel()
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
LV.Columns.Add("No", 40, HorizontalAlignment.Center)
LV.Columns.Add("Kode Barang", 80, HorizontalAlignment.Center)
LV.Columns.Add("Nama Barang", 80, HorizontalAlignment.Center)
LV.Columns.Add("Merk", 60, HorizontalAlignment.Center)
LV.Columns.Add("Harga", 70, HorizontalAlignment.Center)
LV.Columns.Add("Jumlah", 50, HorizontalAlignment.Center)
LV.Columns.Add("Total", 80, HorizontalAlignment.Center)
End Sub
Sub isitabel()
Dim lst As New ListViewItem
With lst
.Text = nopmblian.Text
.SubItems.Add(KB.Text)
.SubItems.Add(NB.Text)
.SubItems.Add(Merk.Text)
.SubItems.Add(Harga.Text)
.SubItems.Add(JB.Text)
.SubItems.Add(TH.Text)
End With
LV.Items.Add(lst)
End Sub
Sub tampilkb()
KB.Items.Add("TS001")
KB.Items.Add("TS002")
KB.Items.Add("VG001")
KB.Items.Add("VG002")
End Sub
Sub Bersih()
nopmblian.Text = ""
KB.Text = ""
NB.Text = ""
Merk.Text = ""
Harga.Text = ""
JB.Text = ""
TH.Text = ""
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Buattabel()
Call tampilkb()
Call Bersih()
End Sub
Private Sub Btnsmpn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsmpn.Click
isitabel()
Bersih()
End Sub
Private Sub Btnhpussmuadta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhpussmuadta.Click
LV.Items.Clear()
End Sub
Private Sub Btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnbersih.Click
Bersih()
End Sub
Private Sub Btnhpusdtaygdplih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhpusdtaygdplih.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub Btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnkeluar.Click
Me.Close()
End Sub
Private Sub KB_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB.SelectedIndexChanged
Select Case KB.Text
Case "TS001"
Harga.Text = "105000"
nopmblian.Text = "001"
Case "TS002"
Harga.Text = "75000"
nopmblian.Text = "002"
Case "VG001"
Harga.Text = "90000"
nopmblian.Text = "003"
Case "VG002"
Harga.Text = "60000"
nopmblian.Text = "004"
End Select
Dim x As String
x = Strings.Left(KB.Text, 2)
Select Case x
Case "TS"
Merk.Text = "Toshiba"
Case "VG"
Merk.Text = "V-Gen"
End Select
Dim Y As String
Y = Strings.Right(KB.Text, 5)
If Y = "TS001" Then
NB.Text = "Flashdisk 4GB"
ElseIf Y = "TS002" Then
NB.Text = "Flashdisk 2GB"
ElseIf Y = "VG001" Then
NB.Text = "Flashdisk 4GB"
Else
NB.Text = "Flashdisk 2GB"
End If
End Sub
Private Sub JB_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles JB.KeyPress
If Asc(e.KeyChar) = 13 Then
TH.Text = (Harga.Text * JB.Text)
End If
End Sub
Private Sub JB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JB.TextChanged
End Sub
End Class
Hasilnya :
Mesran.net
Tidak ada komentar:
Posting Komentar