Selesaikanlah Kasus Berikut Ini : Program Menampilkan Listview Untuk Kasus Pemrograman Pemakaian Listrik
Script Code berikut : jawaban NO.1
Public Class Form1
Private Sub Kode_TextChanged(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles Kode.TextChanged
Dim x As String
x = Microsoft.VisualBasic.Right(Kode.Text, 3)
If x = "TOK" Then
Biaya.Text = "150000"
Harga.Text = "500"
ElseIf x = "RUM" Then
Biaya.Text = "50000"
Harga.Text = "200"
ElseIf x = "SWA" Then
Biaya.Text = "400000"
Harga.Text = "1500"
ElseIf x = "PAB" Then
Biaya.Text = "1000000"
Harga.Text = "10000"
End If
x = Microsoft.VisualBasic.Mid(Kode.Text, 4, 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 = "Merendal"
ElseIf x = "BIN" Then
Daerah.Text = "Binjai"
ElseIf x = "PAK" Then
Daerah.Text = "Lubuk Pakam"
End If
No.Text = Microsoft.VisualBasic.Right(Kode.Text, 3)
End Sub
Private Sub BtnProses_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles BtnProses.Click
Besar.Text = (BulanIni.Text - BulanLalu.Text)
Total.Text = Biaya.Text + Harga.Text * Besar.Text
Pajak.Text = (1.5 / 100) * Total.Text
Pembayaran.Text = Total.Text + Pajak.Text
End Sub
Private Sub BtnBersih_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles BtnBersih.Click
Kode.Text = ""
No.Text = ""
Daerah.Text = ""
Harga.Text = ""
Biaya.Text = ""
Harga.Text = ""
BulanIni.Text = ""
BulanLalu.Text = ""
Besar.Text = ""
Total.Text = ""
Pajak.Text = ""
Pembayaran.Text = ""
End Sub
Private Sub BtnKeluar_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles BtnKeluar.Click
End
End Sub
Private Sub BtnSimpan_Click(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles BtnSimpan.Click
Call isitabel()
End Sub
Sub isitabel()
Dim lst As New ListViewItem
lst.Text = Kode.Text
lst.SubItems.Add(No.Text)
lst.SubItems.Add(Daerah.Text)
lst.SubItems.Add(Biaya.Text)
lst.SubItems.Add(Harga.Text)
lst.SubItems.Add(BulanIni.Text)
lst.SubItems.Add(BulanLalu.Text)
lst.SubItems.Add(Besar.Text)
lst.SubItems.Add(Total.Text)
lst.SubItems.Add(Pajak.Text)
lst.SubItems.Add(Pembayaran.Text)
LV.Items.Add(lst)
End Sub
Private Sub BtnHapus_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles BtnHapus.Click
LV.Items.Clear()
End Sub
Private Sub BtnHapusPilih_Click(ByVal sender As System.Object, ByVale As System.EventArgs) Handles BtnHapusPilih.Click
If LV.SelectedItems.Count <> 0 Then
LV.Items.Remove(LV.SelectedItems(0))
Else
MsgBox("pilih data yang akan dihapus")
End If
End Sub
End Class
selesai dech no 1
Nama : M.IKHWAN
NPM : 1111061
Kls : TI-P 1101
Selamat Belajar Pemrograman VB Net ( Pemrograman VB Net di LINK ke http://mesran.net )
0 Komentar untuk "Yuk! Belajar Pemrograman Visual Basic dot Net Di Mesran.Net"