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

[RESOLVED] IIF not doing what I think it should

$
0
0
In a game I'm working on a player selects a ball (either a white ball or a black ball) and that ball is then highlighted. Now in a sub later on in the game I want to turn off the highlighted ball and restore it to it's original image. A white ball has a value of 1 and a black ball has a value of 2.

CurrentBallColor will be either a 1 or a 2. In the below IIF statement my thinking is if I subtract 1 form CurrentBallColor I will get an answer of 0 or 1 which equates to False or True. If I am correct then shouldn't ucBBall(0).Picture be selected if CurrentBallColor is 2 and ucWBall(0).Picture be selected if CurrentBallColor is 1

ucWBall(SelectedBall(CurrentBallColor)).Picture = IIf(CurrentBallColor - 1, ucBBall(0).Picture, ucWBall(0).Picture) 'Turn off brightness

Viewing all articles
Browse latest Browse all 21273

Trending Articles



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