Nah Sekarang Ayo kita eksekusi yang pertama buka dulu Microsof Visual Studio Kalian atau Microsoft visual basic
1. Desain Seperti Gambar Diatas DiBedakan juga boleh
Pilihan Nya Tersedia Di Toolbox pojok kiri atas
2. masukkan kode nya yang pertama
Public Class Form1
Dim a As String
Sub Tampil()
With lvbarang
.Columns.Add("No", 20, HorizontalAlignment.Left)
.Columns.Add("Kode Barang", 85, HorizontalAlignment.Left)
.Columns.Add("Nama Barang", 85, HorizontalAlignment.Left)
.Columns.Add("Harga", 70, HorizontalAlignment.Left)
.Columns.Add("Jumlah", 70, HorizontalAlignment.Left)
.Columns.Add("Total", 70, HorizontalAlignment.Left)
.View = View.Details
.GridLines = True
.FullRowSelect = True
End With
End Sub
Sub KodeBarang()
Cbkode.items.add("MR01")
Cbkode.items.add("KR01")
Cbkode.items.add("LD01")
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Process.Start("www.facebook.com/Muhammad.reza.padillah")
End Sub
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
Process.Start("www.twitter.com/_Pemula_")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Tampil()
Call KodeBarang()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim lst As New ListViewItem
With lst
.Text = txtno.Text
.SubItems.Add(Cbkode.text)
.SubItems.Add(txtnamabarang.Text)
.SubItems.Add(txtharga.Text)
.SubItems.Add(txtjumlah.Text)
.SubItems.Add(txttotal.Text)
End With
lvbarang.Items.Add(lst)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
txtno.Text = ""
txtnamabarang.Text = ""
txtjumlah.Text = ""
txtharga.Text = ""
txttotal.Text = ""
End Sub
Private Sub CbKode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CbKode.SelectedIndexChanged
If CbKode.Text = "MR01" Then
txtnamabarang.Text = "MotherBoard PC"
txtharga.Text = 300000
ElseIf CbKode.Text = "KR01" Then
txtnamabarang.Text = "Keyboard"
txtharga.Text = 45000
ElseIf CbKode.Text = "LD01" Then
txtnamabarang.Text = "LCD"
txtharga.Text = 120000
End If
End Sub
Private Sub txtjumlah_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtjumlah.KeyPress
If e.KeyChar = Chr(13) Then
txttotal.Text = Val(txtharga.Text) * Val(txtjumlah.Text)
Button1.Focus()
End If
End Sub
Private Sub btnhitungtotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhitungtotal.Click
Dim Total As Double = 0
Dim TempNode As ListViewItem
Dim TempDbl As Double
For Each TempNode In lvbarang.Items
If Double.TryParse(TempNode.SubItems.Item(5).Text, TempDbl) Then
Total += TempDbl
End If
Next
txtjumlahkeseluruhan.Text = (Total)
End Sub
End Class
0 comments:
Post a Comment