tampilan form :
listing program
Public Class Form1
Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Kode.SelectedIndexChanged
Dim x, x1 As String
x = Microsoft.VisualBasic.Left(Kode.Text, 2)
x1 = Microsoft.VisualBasic.Right(Kode.Text, 3)
Select Case x
Case "TS" : merk.Text = "Toshiba"
Case "VG" : merk.Text = "V-Gen"
End Select
Select Case x1
Case "001" : Nama.Text = "Flashdisk 4 Gbyte"
Case "002" : Nama.Text = "Flashdisk 2 Gbyte"
End Select
If x = "TS" And x1 = "001" Then
Harga.Text = 105000
ElseIf x = "TS" And x1 = "002" Then
Harga.Text = 75000
ElseIf x = "VG" And x1 = "001" Then
Harga.Text = 90000
ElseIf x = "VG" And x1 = "002" Then
Harga.Text = 60000
Else
Harga.Text = 0
End If
End Sub
Private Sub Tot_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tot.TextChanged
Tot.Text = Val(Harga.Text) * Val(jlh.Text)
End Sub
Private Sub jlh_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jlh.KeyPress
Dim x2 As Integer = Asc(e.KeyChar)
If x2 = 13 Then
Tot.Text = Val(Harga.Text) * Val(jlh.Text)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
End Sub
Sub BuatTabel()
List.Columns.Add("No Pembelian", 80, HorizontalAlignment.Center)
List.Columns.Add("Kode Barang", 180, HorizontalAlignment.Center)
List.Columns.Add("Nama Barang", 180, HorizontalAlignment.Center)
List.Columns.Add("Merk", 80, HorizontalAlignment.Center)
List.Columns.Add("Harga", 80, HorizontalAlignment.Center)
List.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Center)
List.Columns.Add("Total Harga", 80, HorizontalAlignment.Center)
List.View = View.Details
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
IsiTabel()
End Sub
Sub IsiTabel()
Dim lst As New ListViewItem
lst.Text = Kode.Text
lst.SubItems.Add(Nmr.Text)
lst.SubItems.Add(Nama.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(Harga.Text)
lst.SubItems.Add(jlh.Text)
lst.SubItems.Add(Tot.Text)
List.Items.Add(lst)
End Sub
Private Sub Bersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bersih.Click
Kode.Text = ""
Nama.Text = ""
Nmr.Text = ""
Harga.Text = ""
merk.Text = ""
jlh.Text = ""
Tot.Text = ""
End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click
List.Items.Clear()
End Sub
Private Sub Pil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Pil.Click
List.Items.Remove(List.SelectedItems(0))
End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
End
End Sub
End Class
Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Kode.SelectedIndexChanged
Dim x, x1 As String
x = Microsoft.VisualBasic.Left(Kode.Text, 2)
x1 = Microsoft.VisualBasic.Right(Kode.Text, 3)
Select Case x
Case "TS" : merk.Text = "Toshiba"
Case "VG" : merk.Text = "V-Gen"
End Select
Select Case x1
Case "001" : Nama.Text = "Flashdisk 4 Gbyte"
Case "002" : Nama.Text = "Flashdisk 2 Gbyte"
End Select
If x = "TS" And x1 = "001" Then
Harga.Text = 105000
ElseIf x = "TS" And x1 = "002" Then
Harga.Text = 75000
ElseIf x = "VG" And x1 = "001" Then
Harga.Text = 90000
ElseIf x = "VG" And x1 = "002" Then
Harga.Text = 60000
Else
Harga.Text = 0
End If
End Sub
Private Sub Tot_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tot.TextChanged
Tot.Text = Val(Harga.Text) * Val(jlh.Text)
End Sub
Private Sub jlh_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jlh.KeyPress
Dim x2 As Integer = Asc(e.KeyChar)
If x2 = 13 Then
Tot.Text = Val(Harga.Text) * Val(jlh.Text)
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
End Sub
Sub BuatTabel()
List.Columns.Add("No Pembelian", 80, HorizontalAlignment.Center)
List.Columns.Add("Kode Barang", 180, HorizontalAlignment.Center)
List.Columns.Add("Nama Barang", 180, HorizontalAlignment.Center)
List.Columns.Add("Merk", 80, HorizontalAlignment.Center)
List.Columns.Add("Harga", 80, HorizontalAlignment.Center)
List.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Center)
List.Columns.Add("Total Harga", 80, HorizontalAlignment.Center)
List.View = View.Details
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
IsiTabel()
End Sub
Sub IsiTabel()
Dim lst As New ListViewItem
lst.Text = Kode.Text
lst.SubItems.Add(Nmr.Text)
lst.SubItems.Add(Nama.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(Harga.Text)
lst.SubItems.Add(jlh.Text)
lst.SubItems.Add(Tot.Text)
List.Items.Add(lst)
End Sub
Private Sub Bersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bersih.Click
Kode.Text = ""
Nama.Text = ""
Nmr.Text = ""
Harga.Text = ""
merk.Text = ""
jlh.Text = ""
Tot.Text = ""
End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click
List.Items.Clear()
End Sub
Private Sub Pil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Pil.Click
List.Items.Remove(List.SelectedItems(0))
End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
End
End Sub
End Class
hasil program :
demikian posingan saya ini :
nama : Firman.M
kelas : TI-P.1103
Npm : 1111359
mesran.net
Tidak ada komentar:
Posting Komentar