Random
Public Class Form1
Dim rv As New Random
Dim a As Integer
Dim x As Integer
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Label4.Text = ""
a = 0
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Button1.Enabled = False
Button2.Enabled = True
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
Label4.Text = "Mengacak"
End Sub
Private Sub Timer1_Tick(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Label1.Text = rv.Next(3)
End Sub
Private Sub Timer2_Tick(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Timer2.Tick
Label2.Text = rv.Next(3)
End Sub
Private Sub Timer3_Tick(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Timer3.Tick
Label3.Text = rv.Next(3)
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Button2.Enabled = False
Button1.Enabled = True
Timer4.Enabled = True
Label4.Text = "Menuggu"
End Sub
Private Sub Timer4_Tick(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Timer4.Tick
a = a + 1
If a =
1 Then
Timer1.Enabled = False
ElseIf
a = 10 Then
Timer2.Enabled = False
ElseIf
a = 20 Then
Timer3.Enabled = False
Timer4.Enabled = False
a = 0
If
Label1.Text = Label2.Text And _
Label2.Text = Label3.Text Then
Label4.Text = "Berhasil"
Label5.Text = Val(Label5.Text)
+ 100
Else
Label4.Text = "Coba lagi"
Label5.Text = Val(Label5.Text)
- 100
End
If
If
Val(Label5.Text) <= 0 Then
Label4.Text = "Modal habis"
End
If
End If
End Sub
End Class
Tidak ada komentar:
Posting Komentar