Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27085

If -> And --> Then : Help me figure out this seemingly simple chain of events :-)

$
0
0
Each time my program performs a certain action, a integer named 'actionCount' goes up by 1 using actionCount +=1 inside the action routine. I also have Timer 4, start when the actions do. It's supposed to wait until the actionCount reach's 90, or 182, or 268, or 355 & so on....At those certain points, it should stop Timer 3 (in which the action routine is housed). Instead after it performs 1 action, it seems to get triggered. Did i write my syntax incorrectly in the IF statement?

Or is it somehow skipping the IF statement at the top & going directly to If Ltimepassed = 0 Then... Even though actionCount is not = to 90

I also have some "ELSE" statements at the bottom of the timer. Would these else statements get run, since actionCount is not = 90 & the timer is running? I thought else statements only ran though...If the "IF" statement got picked up first.....I'm confused.

Code:

Public Dim actionCount As Integer = 0
Public Dim Ltimepassed As Integer = 0
       
        If actionCount = 90 Or 182 Or 268 Or 355 Or 455 Or 544 Or 633 And StopActionsAndWait < 3 Then

            Select Case StopActionsAndWait

                Case 1
                    If Ltimepassed = 0 Then
                        Timer3.Enabled = False
                        StopActionsAndWait +=1

                After stopping Timer3, it goes on to basically shut down & clear out old data etc. At the end I set StopActionsAndWait to = 4, in order to end the sub. And then I start back up timer3 in the Else statements at the bottom


Viewing all articles
Browse latest Browse all 27085

Trending Articles



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