PERTEMUAN 5
Assalamualaikum,
dipertemuan kali ini aku akan menjelaskan bagaimana cara Membuat ComboBox dan ListBox di Pemrograman visual basic, ini memang menuju tahap sulit yg berikutnya. dikatakan sulit sebab kita harus teliti, sebab antara combobox dan listbox kali ini sangat berhubungan.
pribadi saja, aku beri judul " Menu dan paket makan Restaurant chef Hendri" hoho.
1. menyerupai biasa buat form berikut :
2. kemudian ganti (name) pada properties
3. masukan arahan berikut :
- buat form_load, secara manual. kemudian isikan arahan berikut :
cmbmenu.AddItem ("Sarapan Pagi")
cmbmenu.AddItem ("Makan Siang")
cmbpaket.AddItem ("Paket 1")
cmbpaket.AddItem ("Paket 2")
cmbmenu.AddItem ("Makan Siang")
cmbpaket.AddItem ("Paket 1")
cmbpaket.AddItem ("Paket 2")
- cmbpaket :
If cmbmenu.Text = "Sarapan Pagi" Then
Select Case (cmbpaket.Text)
Case "Paket 1"
List1.Clear
List1.AddItem ("Nasi Uduk")
List1.AddItem ("Telur")
List1.AddItem ("TEmpe Orek")
txthrgmenu = 5000
Case Else
List1.Clear
List1.AddItem ("Nasi Goreng")
List1.AddItem ("Telur MAta Sapi")
List1.AddItem ("tempe Goreng")
txthrgmenu = 7000
End Select
Else
Select Case (cmbpaket.Text)
Case "Paket 1"
List1.Clear
List1.AddItem ("Nasi Putih")
List1.AddItem ("Ayam BAkar")
List1.AddItem ("Lalapan")
txthrgmenu = 8000
Case Else
List1.Clear
List1.AddItem ("Nasi putih")
List1.AddItem ("Rendang")
List1.AddItem ("Sayur")
List1.AddItem ("Sambal Ijo")
txthrgmenu = 10000
End Select
End If
Select Case (cmbpaket.Text)
Case "Paket 1"
List1.Clear
List1.AddItem ("Nasi Uduk")
List1.AddItem ("Telur")
List1.AddItem ("TEmpe Orek")
txthrgmenu = 5000
Case Else
List1.Clear
List1.AddItem ("Nasi Goreng")
List1.AddItem ("Telur MAta Sapi")
List1.AddItem ("tempe Goreng")
txthrgmenu = 7000
End Select
Else
Select Case (cmbpaket.Text)
Case "Paket 1"
List1.Clear
List1.AddItem ("Nasi Putih")
List1.AddItem ("Ayam BAkar")
List1.AddItem ("Lalapan")
txthrgmenu = 8000
Case Else
List1.Clear
List1.AddItem ("Nasi putih")
List1.AddItem ("Rendang")
List1.AddItem ("Sayur")
List1.AddItem ("Sambal Ijo")
txthrgmenu = 10000
End Select
End If
- option1
txthrgfasilitas = 5000
- option2
txthrgfasilitas = 0
- check1
If Check1 = 1 And Check2 = 1 Then
txthrgminum = 3000
ElseIf Check1 = 1 And Check2 = 0 Then
txthrgminum = 2500
ElseIf Check1 = 0 And Check2 = 1 Then
txthrgminum = 500
Else
txthrgminum = 0
End If
txthrgminum = 3000
ElseIf Check1 = 1 And Check2 = 0 Then
txthrgminum = 2500
ElseIf Check1 = 0 And Check2 = 1 Then
txthrgminum = 500
Else
txthrgminum = 0
End If
-check2
If Check1 = 1 And Check2 = 1 Then
txthrgminum = 3000
ElseIf Check1 = 1 And Check2 = 0 Then
txthrgminum = 2500
ElseIf Check1 = 0 And Check2 = 1 Then
txthrgminum = 500
Else
txthrgminum = 0
End If
txthrgminum = 3000
ElseIf Check1 = 1 And Check2 = 0 Then
txthrgminum = 2500
ElseIf Check1 = 0 And Check2 = 1 Then
txthrgminum = 500
Else
txthrgminum = 0
End If
- txtjumbel (ket, bukan menggunakan click, tapi ubah menggunakan keypress)
If KeyAscii = 13 Then
txttotbay = Val(txtjumbel) * (Val(txthrgfasilitas) + Val(txthrgminum) + Val(txthrgmenu))
txtubay.SetFocus
End If
txttotbay = Val(txtjumbel) * (Val(txthrgfasilitas) + Val(txthrgminum) + Val(txthrgmenu))
txtubay.SetFocus
End If
- txtubay (ket, bukan menggunakan click, tapi ubah menggunakan keypress)
If KeyAscii = 13 Then
txtukem = Val(txtubay) - Val(txttotbay)
End If
txtukem = Val(txtubay) - Val(txttotbay)
End If
5. coba running !!! Sumber http://www.hendrisetiawan.com