Pert.9 Visual Basic (prosedur)

Ada studi kasus sederhana mengenai prosedur, prosedur dapat kita buat sendiri dengan mengetikan nama prosedur pada bagian coding form general. untuk lebih jelas bisa kita praktekan langsung.

Tampilan Awal Design
vb3.JPG

Ketentuan Soal :
kode : 001,002,003
judul : Conan Series, Doraemon Series, Sincan Series
harga : 45000, 35000, 25000

Fasilitas : Pack (5000), delivery (10000)

Total Bayar = (jumlah beli * harga film) + biaya fasilitas

Listing Program :
Private Sub Form_Load()
sembunyi
bersih
End Sub

Private Sub bersih()
txtnm.Text = “”
txthrg.Text = “”
txtjumbel.Text = “”
Check1 = 0
Check2 = 0
txtfas.Text = “0”
txttotbay.Text = “0”
End Sub

Private Sub muncul()
Label3.Visible = True
txtnm.Visible = True
Label4.Visible = True
txthrg.Visible = True
Label2.Visible = False
List1.Visible = False
End Sub

Private Sub sembunyi()
Label3.Visible = False
txtnm.Visible = False
Label4.Visible = False
txthrg.Visible = False
Label2.Visible = True
List1.Visible = True
End Sub

Private Sub List1_Click()
If List1.Text = “001” Then
txtnm.Text = “Conan Series”
txthrg.Text = 45000
Else
If List1.Text = “002” Then
txtnm.Text = “Doraemon Series”
txthrg.Text = 35000
Else
txtnm.Text = “Sincan Series”
txthrg.Text = 25000
End If
End If
muncul
txtjumbel.SetFocus
End Sub

Private Sub Check1_Click()
If Check1 = 1 And Check2 = 0 Then
txtfas.Text = 5000
Else
If Check1 = 0 And Check2 = 1 Then
txtfas.Text = 10000
Else
If Check1 = 1 And Check2 = 1 Then
txtfas.Text = 15000
Else
txtfas.Text = 0
End If
End If
End If
End Sub

Private Sub Check1_Click()
If Check1 = 1 And Check2 = 0 Then
txtfas.Text = 5000
Else
If Check1 = 0 And Check2 = 1 Then
txtfas.Text = 10000
Else
If Check1 = 1 And Check2 = 1 Then
txtfas.Text = 15000
Else
txtfas.Text = 0
End If
End If
End If
End Sub

Private Sub hitung()
Dim a, c As Currency
Dim b As Integer
a = txthrg.Text
b = txtjumbel.Text
c = Val(txtfas.Text)
txttotbay.Text = (a * b) + c
End Sub

Private Sub cmdhitung_Click()
hitung
End Sub

Private Sub cmdinput_Click()
sembunyi
bersih
End Sub

Private Sub cmdkeluar_Click()
MsgBox “Anda Ingin Keluar ?”, vbOKOnly, “Informasi”
Unload Me
End Sub

Tampilan Saat Dijalankan
vb11.JPG

Tampilan Saat DiCoba
vb2.JPG

SELAMAT MENCOBA….

Iklan

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