[postlink]https://eriirawan78.blogspot.com/2013/06/listin.html[/postlink]
Listing Program:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kode.Items.Add(“TS001″)
kode.Items.Add(“TS002″)
kode.Items.Add(“VG001″)
kode.Items.Add(“VG002″)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kode.Items.Add(“TS001″)
kode.Items.Add(“TS002″)
kode.Items.Add(“VG001″)
kode.Items.Add(“VG002″)
BuatTabel()
End Sub
End Sub
Private Sub
kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles kode.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Left(kode.Text, 2)
Select Case x
Case “TS” : merk.Text = “Samsum”
Case “VG” : merk.Text = “ LG”
Dim x As String
x = Microsoft.VisualBasic.Left(kode.Text, 2)
Select Case x
Case “TS” : merk.Text = “Samsum”
Case “VG” : merk.Text = “ LG”
Case “KG” : merk.Text = “LG”
End Select
Dim y As String
y = Microsoft.VisualBasic.Right(kode.Text, 3)
Select Case y
Case “001″ : nama.Text = “Samsum komputer”
Case “002″ : nama.Text = “TV”
End Select
If x = “TS” And y = “001″ Then
harga.Text = “2500000″
ElseIf x = “TS” And y = “002″ Then
harga.Text = “75000″
ElseIf x = “VG” And y = “001″ Then
harga.Text = “90000″
ElseIf x = “VG” And y = “002″ Then
harga.Text = “60000″
End If
End Select
Dim y As String
y = Microsoft.VisualBasic.Right(kode.Text, 3)
Select Case y
Case “001″ : nama.Text = “Samsum komputer”
Case “002″ : nama.Text = “TV”
End Select
If x = “TS” And y = “001″ Then
harga.Text = “2500000″
ElseIf x = “TS” And y = “002″ Then
harga.Text = “75000″
ElseIf x = “VG” And y = “001″ Then
harga.Text = “90000″
ElseIf x = “VG” And y = “002″ Then
harga.Text = “60000″
End If
End Sub
Private Sub jumlah_KeyPress(ByVal
sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
jumlah.KeyPress
Dim tombol As Integer = Asc(e.KeyChar)
If tombol = 13 Then
total.Text = Val(harga.Text) * Val(jumlah.Text)
End If
End Sub
Sub BuatTabel()
LV.Columns.Add(“No Pembelian”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Kode Barang”, 180, HorizontalAlignment.Left)
LV.Columns.Add(“Nama Barang”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Merk”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Harga”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Jumlah Beli”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Total Harga”, 80, HorizontalAlignment.Center)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Dim tombol As Integer = Asc(e.KeyChar)
If tombol = 13 Then
total.Text = Val(harga.Text) * Val(jumlah.Text)
End If
End Sub
Sub BuatTabel()
LV.Columns.Add(“No Pembelian”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Kode Barang”, 180, HorizontalAlignment.Left)
LV.Columns.Add(“Nama Barang”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Merk”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Harga”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Jumlah Beli”, 80, HorizontalAlignment.Center)
LV.Columns.Add(“Total Harga”, 80, HorizontalAlignment.Center)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
Lst.Text = no.Text
Lst.SubItems.Add(kode.Text)
Lst.SubItems.Add(nama.Text)
Lst.SubItems.Add(merk.Text)
Lst.SubItems.Add(harga.Text)
Lst.SubItems.Add(jumlah.Text)
Lst.SubItems.Add(total.Text)
LV.Items.Add(Lst)
End Sub
Dim Lst As New ListViewItem
Lst.Text = no.Text
Lst.SubItems.Add(kode.Text)
Lst.SubItems.Add(nama.Text)
Lst.SubItems.Add(merk.Text)
Lst.SubItems.Add(harga.Text)
Lst.SubItems.Add(jumlah.Text)
Lst.SubItems.Add(total.Text)
LV.Items.Add(Lst)
End Sub
Private Sub btnsimpan_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
IsiTabel()
End Sub
Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
LV.Items.Clear()
End Sub
IsiTabel()
End Sub
Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
LV.Items.Clear()
End Sub
Private Sub btnhapusyang_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles
btnhapusyang.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
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
End
End Sub
End
End Sub
Private Sub btnbersih_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
no.Text = “”
nama.Text = “”
kode.Text = “”
merk.Text = “”
harga.Text = “”
total.Text = “”
jumlah.Text = “”
End Sub
End Class
no.Text = “”
nama.Text = “”
kode.Text = “”
merk.Text = “”
harga.Text = “”
total.Text = “”
jumlah.Text = “”
End Sub
End Class
demikianlah
postingan saya yang ber:
NAMA:
ERIIRAWAN
NPM:
1111619
KELAS
:TI.P1106
0 komentar:
Posting Komentar