Soal Kuis Pak Mesran Hal 33

Postingan Jawaban No 2 (Nama Anda)

Untuk kasus Klik Link Di bawah ini

http://mesran.wordpress.com/2012/01/26/soal-quiz-online-hari-selasa-2/

 

Listing Program

 

Public Class latihan
Sub table()
ListView1.Columns.Add(“NO.Pembelian”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“Kode Brg”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“Nama Brg”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“Merk”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“Harga”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“Jumlah Beli”, 80, HorizontalAlignment.Left)
ListView1.Columns.Add(“T.Gaji”, 80, HorizontalAlignment.Left)
ListView1.View = View.Details
ListView1.GridLines = True
ListView1.FullRowSelect = True
End Sub
Sub isi()
Dim lst As New ListViewItem
lst.Text = no.Text
lst.SubItems.Add(kode.Text)
lst.SubItems.Add(nama.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jumlah.Text)
lst.SubItems.Add(total.Text)
ListView1.Items.Add(lst)
End Sub
Private Sub latihan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
table()
AddJumlah()

 

kode.Items.Add(“TS001”)
kode.Items.Add(“TS002”)
kode.Items.Add(“VG001”)
kode.Items.Add(“VG002”)

End Sub
Sub AddJumlah()
For i = 1 To 100
jumlah.Items.Add(i)
Next
End Sub
Private Sub hitung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hitung.Click
total.Text = Val(jumlah.Text) * Val(harga.Text)

End Sub

 

Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
Dim latihan As String
Microsoft.VisualBasic.Left(kode.Text, 2)
latihan = Microsoft.VisualBasic.Left(kode.Text, 2)
If latihan = “TS” Then
merk.Text = “TOSHIBA”
ElseIf latihan = “VG” Then
merk.Text = “V-Gen”
End If
latihan = Microsoft.VisualBasic.Right(kode.Text, 3)
If latihan = “001” Then
nama.Text = “Flasdic 4GB”
ElseIf latihan = “002” Then
nama.Text = “Flasdisc 2GB”

End If
harga.Text = Microsoft.VisualBasic.Right(kode.Text, 5)
If kode.Text = “TS001” Then
harga.Text = 105000
ElseIf kode.Text = “TS002” Then
harga.Text = 75000
ElseIf kode.Text = “VG001” Then
harga.Text = 90000
ElseIf kode.Text = “VG002” Then
harga.Text = 60000
End If
no.Text = Microsoft.VisualBasic.Right(kode.Text, 3)

 
End Sub

Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Dim i As Byte
i = MsgBox(“Apakah Anda Ingin Keluar Dari program Ini”, MsgBoxStyle.YesNo, “Kembali Ke Menu Utama”)
If i = vbYes Then
End

End If
End Sub

Private Sub jumlah_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
Dim tombol As Integer = Asc(e.KeyChar)
If tombol = 13 Then
hitung_Click(sender, e)

End If
End Sub

Private Sub jumlah_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
isi()

no.Text = “”
kode.Text = “”
nama.Text = “”
merk.Text = “”
harga.Text = “”
jumlah.Text = “”
total.Text = “”
End Sub

Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
ListView1.Items.Remove(ListView1.SelectedItems(0))
End Sub

Private Sub hapusss_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapusss.Click
ListView1.Items.Clear()
End Sub
Private Sub jumlah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumlah.SelectedIndexChanged

End Sub
End Class

 

Hasil Program

 

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: