Kasus Tagihan PDAM
Public Class Form1
Private Sub Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click
If nama.Text = "ihsan" And password.Text = "020690" Then
PDAM.Show()
Me.Hide()
Else
MsgBox("username or password yg anda input salah")
nama.Text = ""
password.Text = ""
End If
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
End
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class PDAM
Private Sub TagihanPDAMToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TagihanPDAMToolStripMenuItem.Click
Form3.Show()
End Sub
Private Sub KeluarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KeluarToolStripMenuItem.Click
End
End Sub
Private Sub PDAM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class Form3
Private Sub kode_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles kode.KeyPress
If Asc(e.KeyChar) = 13 Then
Dim x As String
x = Microsoft.VisualBasic.Left(kode.Text, 3)
If x = "pab" Then
tipe.Text = "pabrik"
harga.Text = "500"
Beban.Text = "250000"
ElseIf x = "tok" Then
tipe.Text = "toko"
harga.Text = "300"
Beban.Text = "25000"
ElseIf x = "rum" Then
tipe.Text = "rumah"
harga.Text = "100"
Beban.Text = "15000"
ElseIf x = "swa" Then
tipe.Text = "swalayan"
harga.Text = "200"
Beban.Text = "10000"
End If
x = Microsoft.VisualBasic.Mid(kode.Text, 5, 3)
If x = "med" Then
daerah.Text = "medan"
ElseIf x = "bel" Then
daerah.Text = "belawan"
ElseIf x = "tem" Then
daerah.Text = "aksara"
ElseIf x = "mar" Then
daerah.Text = "marendal"
ElseIf x = "bin" Then
daerah.Text = "binjai"
ElseIf x = "pak" Then
daerah.Text = "lubuk pakam"
End If
nomor.Text = Microsoft.VisualBasic.Right(kode.Text, 3)
End If
End Sub
Private Sub jumlahpakai_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jumlahpakai.KeyPress
If Asc(e.KeyChar) = 13 Then
besar.Text = jumlahpakai.Text * harga.Text
total.Text = Val(Beban.Text) + Val(harga.Text) * besar.Text
pajak.Text = total.Text * 0.01
jumlah.Text = Val(total.Text) + Val(pajak.Text)
End If
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
kode.Text = ""
nomor.Text = ""
daerah.Text = ""
tipe.Text = ""
harga.Text = ""
Beban.Text = ""
jumlahpakai.Text = ""
besar.Text = ""
total.Text = ""
pajak.Text = ""
jumlah.Text = ""
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
End
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Minggu, 29 Januari 2012
Jawaban Soal No 2 (Ihsan Dedy Boy Marpaung)
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BUATTABEL()
kode.Items.Add("TS001")
kode.Items.Add("TS002")
kode.Items.Add("VG001")
kode.Items.Add("VG002")
End Sub
Sub ihsan()
Dim x As String
x = Microsoft.VisualBasic.Left(kode.Text, 2)
If x = "TS" Then
merk.Text = "THOSIBA"
Else
merk.Text = "V-GEN"
End If
x = Microsoft.VisualBasic.Right(kode.Text, 3)
If x = "001" Then
nama.Text = "FLASHDISK 4GB"
Else
nama.Text = "FLASHDISK 2GB"
End If
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
ihsan()
If kode.Text = "TS001" Then
harga.Text = "105000"
ElseIf kode.Text = "TS002" Then
harga.Text = "75000"
ElseIf kode.Text = "VG001" Then
harga.Text = "90000"
Else
harga.Text = "60000"
End If
End Sub
Private Sub jumlah_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jumlah.KeyPress
Dim TOMBOL As Integer = Asc(e.KeyChar)
If TOMBOL = 13 Then
total.Text = harga.Text * jumlah.Text
End If
End Sub
Sub BUATTABEL()
LV.Columns.Add("NO PEMBELI", 80, HorizontalAlignment.Center)
LV.Columns.Add("KODE BARANG", 80, HorizontalAlignment.Left)
LV.Columns.Add("NAMA BARANG", 100, HorizontalAlignment.Left)
LV.Columns.Add("MEREK", 80, HorizontalAlignment.Left)
LV.Columns.Add("HARGA", 80, HorizontalAlignment.Left)
LV.Columns.Add("JUMLAH BELI", 80, HorizontalAlignment.Left)
LV.Columns.Add("TOTAL HARGA", 80, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub ISITABEL()
Dim LST As New ListViewItem
LST.Text = nomor.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)
LV.Items.Add(LST)
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
ISITABEL()
End Sub
Private Sub Bersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bersih.Click
nomor.Text = ""
kode.Text = ""
nama.Text = ""
merk.Text = ""
harga.Text = ""
jumlah.Text = ""
total.Text = ""
End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
End
End Sub
Private Sub hapusn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapusn.Click
LV.Items.Clear()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
End Class
Langganan:
Postingan (Atom)