kasus
http://mesran.wordpress.com/2012/01/26/soal-quiz-online-hari-kamis/comment-page-5/#comments
listing program
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
kode.Items.Add("TS001")
kode.Items.Add("TS002")
kode.Items.Add("VG001")
kode.Items.Add("VG002")
End Sub
Sub barang()
Dim x As String
x = Microsoft.VisualBasic.Left(kode.Text, 2)
If x = "TS" Then
merk.Text = "Toshiba"
ElseIf x = "VG" Then
merk.Text = "V-Gen"
End If
x = Microsoft.VisualBasic.Mid(kode.Text, 3, 3)
If x = "001" Then
brg.Text = "Flasdisk 4GB"
ElseIf x = "002" Then
brg.Text = "Flasdisk 2GB"
End If
If kode.Text = "TS001" Then
hrg.Text = 105000
ElseIf kode.Text = "TS002" Then
hrg.Text = 75000
End If
If kode.Text = "VG001" Then
hrg.Text = 90000
ElseIf kode.Text = "VG002" Then
hrg.Text = 60000
End If
End Sub
Sub BuatTabel()
With LV
.Columns.Add("No Pembelian", 80, HorizontalAlignment.Center)
.Columns.Add("Kode Barang", 120, HorizontalAlignment.Left)
.Columns.Add("Nama Barang", 100, HorizontalAlignment.Left)
.Columns.Add("Merk", 100, HorizontalAlignment.Left)
.Columns.Add("Harga", 100, HorizontalAlignment.Left)
.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Left)
.Columns.Add("Total Harga", 80, HorizontalAlignment.Left)
.GridLines = True
.FullRowSelect = True
.View = View.Details
End With
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
With Lst
.Text = pmblian.Text()
.SubItems.Add(kode.Text)
.SubItems.Add(brg.Text)
.SubItems.Add(merk.Text)
.SubItems.Add(hrg.Text)
.SubItems.Add(jumlah.Text)
.SubItems.Add(total.Text)
LV.Items.Add(Lst)
End With
End Sub
Private Sub kodbrg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
Call barang()
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
Private Sub btndata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndata.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
pmblian.Text = ""
kode.Text = ""
brg.Text = ""
merk.Text = ""
hrg.Text = ""
jumlah.Text = ""
total.Text = ""
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
End
End Sub
Private Sub jlhbeli_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumlah.TextChanged
total.Text = Val(jumlah.Text) * Val(hrg.Text)
End Sub
End Class
hasil program
http://mesran.wordpress.com/2012/01/26/soal-quiz-online-hari-kamis/comment-page-5/#comments
listing program
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
kode.Items.Add("TS001")
kode.Items.Add("TS002")
kode.Items.Add("VG001")
kode.Items.Add("VG002")
End Sub
Sub barang()
Dim x As String
x = Microsoft.VisualBasic.Left(kode.Text, 2)
If x = "TS" Then
merk.Text = "Toshiba"
ElseIf x = "VG" Then
merk.Text = "V-Gen"
End If
x = Microsoft.VisualBasic.Mid(kode.Text, 3, 3)
If x = "001" Then
brg.Text = "Flasdisk 4GB"
ElseIf x = "002" Then
brg.Text = "Flasdisk 2GB"
End If
If kode.Text = "TS001" Then
hrg.Text = 105000
ElseIf kode.Text = "TS002" Then
hrg.Text = 75000
End If
If kode.Text = "VG001" Then
hrg.Text = 90000
ElseIf kode.Text = "VG002" Then
hrg.Text = 60000
End If
End Sub
Sub BuatTabel()
With LV
.Columns.Add("No Pembelian", 80, HorizontalAlignment.Center)
.Columns.Add("Kode Barang", 120, HorizontalAlignment.Left)
.Columns.Add("Nama Barang", 100, HorizontalAlignment.Left)
.Columns.Add("Merk", 100, HorizontalAlignment.Left)
.Columns.Add("Harga", 100, HorizontalAlignment.Left)
.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Left)
.Columns.Add("Total Harga", 80, HorizontalAlignment.Left)
.GridLines = True
.FullRowSelect = True
.View = View.Details
End With
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
With Lst
.Text = pmblian.Text()
.SubItems.Add(kode.Text)
.SubItems.Add(brg.Text)
.SubItems.Add(merk.Text)
.SubItems.Add(hrg.Text)
.SubItems.Add(jumlah.Text)
.SubItems.Add(total.Text)
LV.Items.Add(Lst)
End With
End Sub
Private Sub kodbrg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
Call barang()
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
Private Sub btndata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndata.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
pmblian.Text = ""
kode.Text = ""
brg.Text = ""
merk.Text = ""
hrg.Text = ""
jumlah.Text = ""
total.Text = ""
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
End
End Sub
Private Sub jlhbeli_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumlah.TextChanged
total.Text = Val(jumlah.Text) * Val(hrg.Text)
End Sub
End Class
hasil program
Tidak ada komentar:
Posting Komentar