SELAMAT DATANG DI BLOG SAYA, SAYA AKAN MEMPOSTING
MENGENAI PROGRAM VISUAL BASIC 10 YANG
SAYA BUAT
PROJECT LATIHAN 16
Public Class Formlat16
Dim Tipe(100) As String
Dim Banyak(100) As Integer
Dim HargaSat(100), Jumlah(100), Total As Double
Dim Nomor = 0
'Badan Fungsi
Private Function
JumlahJual(ByVal Byk As
Integer, ByVal
Hrg As Double) As Double
JumlahJual
= Byk * Hrg
Return JumlahJual
End Function
Private Function
TotalJual(ByVal BanyakTrx As Integer) As Double
Dim ulang As Integer
TotalJual =
0
For ulang = 0 To
BanyakTrx
TotalJual = TotalJual + Jumlah(ulang)
Next
Return (TotalJual)
End Function
Sub AturLvTransaksi()
LvTransaksi.View
= View.Details
LvTransaksi.FullRowSelect = True
LvTransaksi.GridLines = True
LvTransaksi.Columns.Add("No",
30, HorizontalAlignment.Center)
LvTransaksi.Columns.Add("Tipe
Kendaraan", 250, HorizontalAlignment.Center)
LvTransaksi.Columns.Add("Harga @",
120, HorizontalAlignment.Center)
LvTransaksi.Columns.Add("Banyak",
50, HorizontalAlignment.Center)
LvTransaksi.Columns.Add("Jumlah",
160, HorizontalAlignment.Center)
End Sub
Sub IsiLvTransaksi()
Dim isi As New ListViewItem
HargaSat(Nomor) = Val(Me.TxtHargaSat.Text)
Banyak(Nomor) = Val(Me.Txtbanyak.Text)
'prose pengalian fungsi Jumlah Jual dan dimasukan ke dalam
variabel jumlah
Jumlah(Nomor) = JumlahJual(Banyak(Nomor), HargaSat(Nomor))
isi.Text =
Nomor + 1.ToString
isi.SubItems.Add(Me.TxtTipemobil.Text)
isi.SubItems.Add(Me.TxtHargaSat.Text)
isi.SubItems.Add(Me.Txtbanyak.Text)
isi.SubItems.Add(Jumlah(Nomor).ToString)
LvTransaksi.Items.Add(isi)
Nomor += 1
End Sub
Sub Baru()
Me.TxtTipemobil.Clear()
Me.TxtHargaSat.Clear()
Me.Txtbanyak.Clear()
Me.TxtTipemobil.Focus()
Me.Btambah.Enabled = False
End Sub
Private Sub
Btambah_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Btambah.Click
Call IsiLvTransaksi()
Total =
TotalJual(Nomor)
Me.TxtTotal.Text = Total.ToString
Call Baru()
End Sub
Private Sub
Formlat16_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
utama.Enabled = True
utama.Show()
Me.Hide()
End Sub
Private Sub
Formlat16_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
utama.Enabled = True
utama.Show()
Me.Hide()
End Sub
Private Sub
Formlat16_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
Call AturLvTransaksi()
End Sub
Private Sub
Txtbanyak_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Txtbanyak.TextChanged
Me.Btambah.Enabled = True
End Sub
End Class
Tidak ada komentar:
Posting Komentar