Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 132,650 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,148 people online right now. Registration is fast and FREE... Join Now!




Help with VB6 timer

 
Reply to this topicStart new topic

Help with VB6 timer, timer sequencing in VB6

mint214
post 14 Aug, 2008 - 11:02 PM
Post #1


New D.I.C Head

*
Joined: 1 Aug, 2008
Posts: 5

vb
'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...happy.gif
User is offlineProfile CardPM

Go to the top of the page

Zhalix
post 15 Aug, 2008 - 08:57 AM
Post #2


D.I.C Head

**
Joined: 7 May, 2008
Posts: 218



Thanked 9 times
My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

thava
post 15 Aug, 2008 - 04:17 PM
Post #3


D.I.C Regular

Group Icon
Joined: 17 Apr, 2007
Posts: 425



Thanked 17 times

Dream Kudos: 50
My Contributions


hust call this in your timer event

CODE


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


User is offlineProfile CardPM

Go to the top of the page

mint214
post 28 Aug, 2008 - 10:35 PM
Post #4


New D.I.C Head

*
Joined: 1 Aug, 2008
Posts: 5

QUOTE(thava @ 15 Aug, 2008 - 05:17 PM) *

hust call this in your timer event

CODE


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...
happy.gif
User is offlineProfile CardPM

Go to the top of the page

thava
post 1 Sep, 2008 - 04:52 PM
Post #5


D.I.C Regular

Group Icon
Joined: 17 Apr, 2007
Posts: 425



Thanked 17 times

Dream Kudos: 50
My Contributions


if the post is realy help you click the This Post Was Helpful! link
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 05:11AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month