RANDOM COMMAND BUTTON SELECTION AND ELAPSED TIME USING VB

VB PROGRAM CODE:-

Private mintCount As Integer
Private Sub Command1_Click(Index As Integer)
Dim n As Integer
Static t As Integer

For n = 0 To 30
Command1(n).Caption = ""
Next
Randomize Timer
n = Int(Rnd * 31)
If Index = n Then
Command1(n).Caption = "0"
Command1(n).BackColor = vbRed

Else: Command1(n).Caption = "0"
Command1(n).BackColor = vbRed
End If

Label6.Caption = t
t = t + 1
End Sub
Private Sub Command2_Click()
 mintCount = 0
Cls
Timer1.Enabled = True
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
Label4.Caption = mintCount / 30
End Sub
Private Sub Timer1_Timer()
mintCount = mintCount + 1
Label2.Caption = mintCount
End Sub

OUTPUT:-



Post a Comment

RANDOM COMMAND BUTTON SELECTION AND ELAPSED TIME USING VB

VB PROGRAM CODE:-

Private mintCount As Integer
Private Sub Command1_Click(Index As Integer)
Dim n As Integer
Static t As Integer

For n = 0 To 30
Command1(n).Caption = ""
Next
Randomize Timer
n = Int(Rnd * 31)
If Index = n Then
Command1(n).Caption = "0"
Command1(n).BackColor = vbRed

Else: Command1(n).Caption = "0"
Command1(n).BackColor = vbRed
End If

Label6.Caption = t
t = t + 1
End Sub
Private Sub Command2_Click()
 mintCount = 0
Cls
Timer1.Enabled = True
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
Label4.Caption = mintCount / 30
End Sub
Private Sub Timer1_Timer()
mintCount = mintCount + 1
Label2.Caption = mintCount
End Sub

OUTPUT:-



Post a Comment