Help with VB6 timer

timer sequencing in VB6

Page 1 of 1

4 Replies - 1620 Views - Last Post: 01 September 2008 - 05:52 PM Rate Topic: -----

#1 mint214  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 01-August 08

Help with VB6 timer

Posted 15 August 2008 - 12:02 AM

'program underconstuction

-------------------------------------------------------
Option Explicit

'setting variables for player 1,2,3,4
'setting for players score

	Dim Plyr1Scr As Integer
	Dim Plyr2Scr As Integer
	Dim Plyr3Scr As Integer
	Dim Plyr4Scr As Integer

'setting intCnt

	Dim intCnt As Integer
	Dim intQ As Integer
	Dim i As Integer
	Dim q As Integer

'setting for players name

	Dim Plyr1 As String
	Dim Plyr2 As String
	Dim Plyr3 As String
	Dim Plyr4 As String
-------------------------------------------------------
Private Sub Command1_Click()

'incrementing player 1's score and displaying its value

	Plyr1Scr = Plyr1Scr + 5
	Label5.Caption = Plyr1Scr

End Sub
-------------------------------------------------------
Private Sub Command2_Click()

'incrementing player 2's score and displaying its value

	Plyr2Scr = Plyr2Scr + 5
	Label6.Caption = Plyr2Scr

End Sub
-------------------------------------------------------
Private Sub Command3_Click()

'incrementing player 3's score and displaying its value

	Plyr3Scr = Plyr3Scr + 5
	Label7.Caption = Plyr3Scr

End Sub
-------------------------------------------------------
Private Sub Command4_Click()

'incrementing player 4's score and displaying its value

	Plyr4Scr = Plyr4Scr + 5
	Label8.Caption = Plyr4Scr

End Sub
-------------------------------------------------------
Private Sub Form_Load()

'setting initial values of player's score into 0

	Plyr1Scr = 0
	Plyr2Scr = 0
	Plyr3Scr = 0
	Plyr4Scr = 0

'setting the display into 0

	Label5.Caption = "0"
	Label6.Caption = "0"
	Label7.Caption = "0"
	Label8.Caption = "0"
	
'for the players 1,2,3,4 name
	
	Plyr1 = InputBox("Enter the name of Player 1")
	Plyr2 = InputBox("Enter the name of Player 2")
	Plyr3 = InputBox("Enter the name of Player 3")
	Plyr4 = InputBox("Enter the name of Player 4")

'putting the player 1,2,3,4 name into the label

	Label1.Caption = "  " & Plyr1
	Label2.Caption = "  " & Plyr2
	Label3.Caption = "  " & Plyr3
	Label4.Caption = "  " & Plyr4
	
	Label12.Caption = " "
	Label13.Caption = " "
	
'setting time interval for the timer
	
Timer1.Interval = 1000

'calling the function Start


StartTimer
Func0

For i = 1 To 3
q = i
Next i

End Sub
---------------------------------------------------
Private Sub StartTimer()

Timer1.Enabled = True
intCnt = 6
For i = 1 To 3
Next i

End Sub
---------------------------------------------------
Private Sub Func0()

Label13.Caption = "HELLO"
	
End Sub
---------------------------------------------------
Private Sub Func1(q)

If q = 1 Then
Label13.Caption = "HI"
Label12.Caption = " "
End If

If q = 2 Then
Label13.Caption = "WAZUP!"
End If

If q = 3 Then
Label13.Caption = "HOW RU?"
Label12.Caption = " "
End If

End Sub
---------------------------------------------------
Private Sub Timer1_Timer()

If intCnt = 0 Then
'Call the function here
Func1 (q)

Else
intCnt = intCnt - 1
Label12.Caption = intCnt
End If

End Sub




this is the code that i'm working of...
i'm having problem about plz...somebody plz help ne...

i am making a quiz bee program that everytime a certain
set of time(for ex.30) is reached, it then calls a 2nd function that
will display the 2nd question...and so on and so forth...
hope that someone here can help me...^_^

Is This A Good Question/Topic? 0
  • +

Replies To: Help with VB6 timer

#2 Zhalix  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 260
  • Joined: 07-May 08

Re: Help with VB6 timer

Posted 15 August 2008 - 09:57 AM

You didn't tell us what you're having trouble with. It's much easier to help you when we know what you're trying to fix or figure out.
Was This Post Helpful? 0
  • +
  • -

#3 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Help with VB6 timer

Posted 15 August 2008 - 05:17 PM

hust call this in your timer event


q=q+1
if q>3 then
	 q=1
endif
Func1(q)



Was This Post Helpful? 1
  • +
  • -

#4 mint214  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 01-August 08

Re: Help with VB6 timer

Posted 28 August 2008 - 11:35 PM

View Postthava, on 15 Aug, 2008 - 05:17 PM, said:

hust call this in your timer event


q=q+1
if q>3 then
	 q=1
endif
Func1(q)





Thank you very much....
i'd tried it and it works....
More power 2u...
^_^
Was This Post Helpful? 0
  • +
  • -

#5 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: Help with VB6 timer

Posted 01 September 2008 - 05:52 PM

if the post is realy help you click the This Post Was Helpful! link
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1