Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21285

[RESOLVED] Ongoing vb 6 timer problem

$
0
0
I had a previous qustion about a timer not working correctly http://www.vbforums.com/showthread.p...work-correctly
and found a fix by adding both the sound and label
rotation into the timer. my fix has found another problem where the timer is called from within a loop.
The program has an auto-play feature where 20 numbers are produced randomilly to an 80 number msflexgrid.
with each loop 20 numbers are randomilly produced and the results are added up if a win
It works correctly if no win, but the win is where the problem arrises
The problem is the timer only fires one time and returns to the loop
example:
mEndNum = 4
the labes should increment 4 times, but they only do one time and return to the loop
if label lblCredit.Caption = $4.00 and mCurrencyWon = .25 then
$4.25 it stops here and returns to the loop
$4.50
$4.75
$5.00 should stop here

Private Sub Timer1_Timer()
'Dim Counter As Integer
Dim lblcreditcurrency As Currency

If mbStartSound <> True Then
sndData = LoadResData("ADDINGWINNINGS", "SOUND")
sndPlaySound sndData(0), SND_LOOP Or SND_ASYNC Or SND_MEMORY
End If
If miCnt <= mEndNum Then
lblWinThisRun.Caption = lblWinThisRun.Caption + 1
If mCreditMode = 1 Then
' lblcreditcurrency = GetPriceByBetMode(mBetMode)
lblCredit.Caption = CCur(lblCredit.Caption) + mCurrencyWon 'checked out
lblCredit.Caption = Format(lblCredit.Caption, "currency")

miCnt = miCnt + 1

Else
lblCredit.Caption = Val(lblCredit.Caption) + 1
miCnt = miCnt + 1
End If
mbStartSound = True
Else
'Counter = 1
Timer1.Enabled = False
'Stop the Sound
sndPlaySound ByVal 0, 0
mbStartSound = False
End If
End Sub
How can this be fixed ?

Viewing all articles
Browse latest Browse all 21285

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>