Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Removing PictureBox

$
0
0
My issue is that when one picture box comes into contact with another which is found from a list, an event triggers. The idea is that once that event has triggered, the second picturebox ceases to exist. I dont actually need that to happen, but it has to stop running the code after the first time.

The two ways I came up with were:

1) Remove it from the list
2) Delete it outright

Problem is, I cant get them to work.

PictureBoxList.Remove(pb) Doesnt Work, nor do any other ideas from online. Hours of googling hasn't found a solution, none of them work. Most likely its my syntax, but I cant figure it out.

My code is here, with simplified names & redundant code taken out:

For Each pb As PictureBox In PictureBoxList
       If pb.Bounds.IntersectsWith(PictureBoxChar.Bounds) Then
                
                'Event
                'Picturebox From List Destroyed Here

       End If
Next



Thanks in advance,

Viewing all articles
Browse latest Browse all 51036

Trending Articles



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