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

Greater than / less than issues

$
0
0
Hi guys, a noob here with probably a very stupid question.

I'm using a timer to see if a label that is moving around hits a picturebox that is moving around.

Code:

        If picturebox1.Top + 62 > label1.Top < picturebox1.Top Then
            If picturebox1.Left + 76 > label1.Left < picturebox1.Left Then
                labelUp1.Enabled = False 'this is the timer that moves the label around
                GameView.Controls.Remove(label1)
'...more inconsequential code here
            End If
End If



The pictureboxes starting location is 26, 16. The label's is 290, 467. The reason I add to one of the values is to simulate the size of the picturebox.

This seems right to me, but whenever I summon the label it is immediately removed. I can see that the IF statement is being run, but surely it shouldn't be?
Thanks for any help, I'm completely stumped XD

Viewing all articles
Browse latest Browse all 27329

Trending Articles



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