Yuk! Belajar Pemrograman Visual Basic dot net di Mesran.Net
Desain Form....
Berikut Listing
Programnya…
Public Class Form1
Sub
rancangtabel()
With LV
.Columns.Add("No Pembelian", 100,
HorizontalAlignment.Left)
.Columns.Add("Kode Barang", 90,
HorizontalAlignment.Left)
.Columns.Add("Nama Barang", 90,
HorizontalAlignment.Left)
.Columns.Add("Harga", 80, HorizontalAlignment.Left)
.Columns.Add("Jumlah Beli", 90, HorizontalAlignment.Left)
.Columns.Add("Total Harga", 90,
HorizontalAlignment.Left)
.View = View.Details
.GridLines = True
.FullRowSelect = True
End With
End Sub
Sub
isitabel()
Dim lst
As New
ListViewItem
With
lst
.Text = np.Text
.SubItems.Add(kb.Text)
.SubItems.Add(nb.Text)
.SubItems.Add(hr.Text)
.SubItems.Add(jb.Text)
.SubItems.Add(th.Text)
End With
LV.Items.Add(lst)
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
rancangtabel()
kb.Items.Add("TS001")
kb.Items.Add("TS002")
kb.Items.Add("VG001")
kb.Items.Add("VG002")
End Sub
Private Sub kb_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
kb.SelectedIndexChanged
Dim i As String
i =
Microsoft.VisualBasic.Right(kb.Text, 3)
If
kb.Text = "TS001" Then
nb.Text = "Flashdisk
4GB"
ElseIf
kb.Text = "TS002" Then
nb.Text = "Flashdisk
2GB"
ElseIf
kb.Text = "VG001" Then
nb.Text = "Flshdisk
4GB"
ElseIf
kb.Text = "VG002" Then
nb.Text = "Flashdisk
2GB"
End If
Dim q As String
q = Microsoft.VisualBasic.Left(kb.Text,
2)
If
kb.Text = "TS001" Then
mr.Text = "Toshiba"
ElseIf
kb.Text = "TS002" Then
mr.Text = "Toshiba"
ElseIf
kb.Text = "VG001" Then
mr.Text = "V-Gen"
ElseIf
kb.Text = "VG002" Then
mr.Text = "V-Gen"
End If
Select Case kb.Text
Case
"TS001" : hr.Text = "105000"
Case
"TS002" : hr.Text = "75000"
Case
"VG001" : hr.Text = "90000"
Case
"VG002" : hr.Text = "60000"
End Select
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 = Val(hr.Text) *
Val(jb.Text)
End If
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
isitabel()
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 Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
np.Text = ""
kb.Text = ""
nb.Text = ""
mr.Text = ""
hr.Text = ""
jb.Text = ""
th.Text = ""
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
LV.Items.Clear()
np.Text = ""
kb.Text = ""
nb.Text = ""
mr.Text = ""
hr.Text = ""
jb.Text = ""
th.Text = ""
End Sub
Private Sub Button5_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
End
End Sub
End Class
Hasil Program…
Thank You Very Much….