Berikut Jawaban Program :
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
buattabel()
kobar.Items.Add("TS001")
kobar.Items.Add("TS002")
kobar.Items.Add("VG001")
kobar.Items.Add("VG002")
End Sub
Private Sub kobar_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kobar.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Left(kobar.Text, 2)
Select Case x
Case "TS" : merk.Text = "Toshiba"
Case "VG" : merk.Text = "V-GEN"
End Select
x = Microsoft.VisualBasic.Right(kobar.Text, 3)
Select Case x
Case "001" : nabar.Text = "Flashdisk 4GB"
Case "002" : nabar.Text = "Flashdisk 2GB"
End Select
Select Case kobar.Text
Case "TS001" : harga.Text = "105000"
Case "TS002" : harga.Text = "75000"
Case "VG001" : harga.Text = "90000"
Case "VG002" : harga.Text = "60000"
End Select
End Sub
Private Sub jumbel_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jumbel.KeyPress
Dim tombol As Integer = Asc(e.KeyChar)
If tombol = 13 Then
tohar.Text = Val(harga.Text) * Val(jumbel.Text)
End If
End Sub
Sub buattabel()
lv.Columns.Add("No Pembelian", 50, HorizontalAlignment.Left)
lv.Columns.Add("Kode Barang", 80, HorizontalAlignment.Left)
lv.Columns.Add("Nama Barang", 120, HorizontalAlignment.Left)
lv.Columns.Add("Merk", 120, HorizontalAlignment.Left)
lv.Columns.Add("Harga", 120, HorizontalAlignment.Left)
lv.Columns.Add("Jumlah Pembelian", 120, HorizontalAlignment.Left)
lv.Columns.Add("Total Harga", 120, HorizontalAlignment.Left)
Lv.View = View.Details
Lv.GridLines = True
Lv.FullRowSelect = True
End Sub
Sub isitabel()
Dim lst As New ListViewItem
lst.Text = No_beli.Text()
lst.SubItems.Add(kobar.Text)
lst.SubItems.Add(nabar.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jumbel.Text)
lst.SubItems.Add(tohar.Text)
Lv.Items.Add(lst)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
isitabel()
End Sub
Sub bersih()
No_beli.Text = ""
kobar.Text = ""
nabar.Text = ""
merk.Text = ""
harga.Text = ""
jumbel.Text = ""
tohar.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
bersih()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
lv.Items.Clear()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
End
End Sub
End Class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
buattabel()
kobar.Items.Add("TS001")
kobar.Items.Add("TS002")
kobar.Items.Add("VG001")
kobar.Items.Add("VG002")
End Sub
Private Sub kobar_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kobar.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Left(kobar.Text, 2)
Select Case x
Case "TS" : merk.Text = "Toshiba"
Case "VG" : merk.Text = "V-GEN"
End Select
x = Microsoft.VisualBasic.Right(kobar.Text, 3)
Select Case x
Case "001" : nabar.Text = "Flashdisk 4GB"
Case "002" : nabar.Text = "Flashdisk 2GB"
End Select
Select Case kobar.Text
Case "TS001" : harga.Text = "105000"
Case "TS002" : harga.Text = "75000"
Case "VG001" : harga.Text = "90000"
Case "VG002" : harga.Text = "60000"
End Select
End Sub
Private Sub jumbel_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jumbel.KeyPress
Dim tombol As Integer = Asc(e.KeyChar)
If tombol = 13 Then
tohar.Text = Val(harga.Text) * Val(jumbel.Text)
End If
End Sub
Sub buattabel()
lv.Columns.Add("No Pembelian", 50, HorizontalAlignment.Left)
lv.Columns.Add("Kode Barang", 80, HorizontalAlignment.Left)
lv.Columns.Add("Nama Barang", 120, HorizontalAlignment.Left)
lv.Columns.Add("Merk", 120, HorizontalAlignment.Left)
lv.Columns.Add("Harga", 120, HorizontalAlignment.Left)
lv.Columns.Add("Jumlah Pembelian", 120, HorizontalAlignment.Left)
lv.Columns.Add("Total Harga", 120, HorizontalAlignment.Left)
Lv.View = View.Details
Lv.GridLines = True
Lv.FullRowSelect = True
End Sub
Sub isitabel()
Dim lst As New ListViewItem
lst.Text = No_beli.Text()
lst.SubItems.Add(kobar.Text)
lst.SubItems.Add(nabar.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jumbel.Text)
lst.SubItems.Add(tohar.Text)
Lv.Items.Add(lst)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
isitabel()
End Sub
Sub bersih()
No_beli.Text = ""
kobar.Text = ""
nabar.Text = ""
merk.Text = ""
harga.Text = ""
jumbel.Text = ""
tohar.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
bersih()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
lv.Items.Clear()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
End
End Sub
End Class
0 komentar:
Posting Komentar