Minggu, 02 November 2014

Latihan Quiz Visual Basic

Toolbox
Name
Caption
Interval
Label
-
CINEMA 3 SATU

Label
-
Tanggal

Label
jam
-

Label
tgl
-

Timer


100
Label
-
Judul Film

ListBox
List
-

Label
-
Studio

TextBox
studio
-

frame
-
[Jam Tayang]

OptionButton
-
12.00

OptionButton
-
15.00

OptionButton
-
18.00

Label
-
Harga

TextBox
harga
-

Label
-
Jumlah Beli

TextBox
jumbel
-

Frame
-
[Snack]

CheckBox
-
popcorn

Textbox
hargapop


CheckBox
-
Soft Drink

Textbox
hargasd


CommandButton
hitung
HITUNG

Label
-
Total Bayar

TextBox
totbay


CommandButton
bersih
BERSIH

CommandButton
keluar
KELUAR





Private Sub bersih_Click()
studio.Text = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Check1.Value = False
Check2.Value = False
harga.Text = ""
jumbel.Text = ""
hargapop.Text = ""
hargasd.Text = ""
totbay.Text = ""
End Sub

Private Sub Check1_Click()
If Check1 = 1 Then
hargapop.Text = 10000
Else
hargapop.Text = 0
End If
End Sub

Private Sub Check2_Click()
If Check2 = 1 Then
hargasd.Text = 5000
Else
hargasd.Text = 0
End If
End Sub

Private Sub Form_Load()
list.AddItem ("How To Train Your Dragon")
list.AddItem ("Cinta 2 Hati")
list.AddItem ("Clash Of The Titan")
End Sub

Private Sub hitung_Click()
totbay.Text = Val(harga.Text) * Val(jumbel.Text) + (Val(hargapop.Text) + Val(hargasd.Text))
End Sub

Private Sub keluar_Click()
p = MsgBox("Do U Wanna Quit..?", vbQuestion + vbYesNo, "Konfirmasi")
If p = vbYes Then
End
End If
End Sub

Private Sub list_Click()
If list.Text = "How To Train Your Dragon" Then
studio.Text = "Studio 1"
ElseIf list.Text = "Cinta 2 Hati" Then
studio.Text = "Studio 2"
Else
studio.Text = "Studio 3"
End If
End Sub

Private Sub Option1_Click()
harga.Text = 15000
jumbel.SetFocus
End Sub

Private Sub Option2_Click()
harga.Text = 25000
jumbel.SetFocus
End Sub

Private Sub Option3_Click()
harga.Text = 20000
jumbel.SetFocus
End Sub

Private Sub Timer1_Timer()
jam.Caption = Time
tgl.Caption = Format(Date, "dddd, d mmmm yyyy")

End Sub

Tidak ada komentar:

Posting Komentar