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

[RESOLVED] Exit a do loop

$
0
0
I have an 80 number keno game that win run if a win 2 labels are rotated and a sound plays the amount of the win
I am trying to make the labels update instantly if the form is click and skip the label rotation
the mbSpeedTimer is ignored when the form is clicked
The form click sets mbSpeedTimer to true

Code:

Private Sub Form_Click()
mbSpeedTimer = True 'skip label rotation just increase winnings    mbWinInProgress = True


Private Sub Timer1_Timer()
Dim bFinished As Boolean
Dim lblcreditcurrency As Currency
    If mbSpeedTimer Then
      FastAddWins
      Exit Sub
    End If
 
    If mbStartSound = False Then
    mbytData = LoadResData("tick", "SOUND")
    sndPlaySound mbytData(0), SND_LOOP Or SND_ASYNC Or SND_MEMORY
    End If
           
  Do While bFinished = False
    If mbSpeedTimer Then 'speed up win if user clicked form or images
      sndPlaySound ByVal 0, 0 'Stop the Sound
      Timer1.Enabled = False
      Exit Do
      Call FastAddWins ' call the sub to total labels instantly
      Exit Sub
    End If
   
      If mbSpeedTimer = False Then
        Sleep 90 ' added this to slow labels for some reason changing the interval didn't work
        Else
        Exit Do
      End If
       
            lblWinThisRun.Caption = lblWinThisRun.Caption + 1
          If mintCreditMode = 1 Then '
            lblCredit.Caption = CCur(lblCredit.Caption) + mcurCurrencyWon 'checked out
            lblCredit.Caption = Format(lblCredit.Caption, "currency")           
            mlngCnt = mlngCnt + 1
          Else
              lblCredit.Caption = Val(lblCredit.Caption) + 1
            mlngCnt = mlngCnt + 1
          End If
         
        If mlngCnt > mlngEndNum Then
            WaitMessage ' don't know if this is needed or not
            bFinished = True
            DoEvents
        End If
    Loop

            mbStartSound = True
            Timer1.Enabled = False
            sndPlaySound ByVal 0, 0 'Stop the Sound
            mbStartSound = False
            mbWaitforWinToFinish = False
            mbRunInProgress = False
End Sub


Viewing all articles
Browse latest Browse all 21090

Trending Articles



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