I'm making a game for my visual basic course. I have multiple picture boxes that when clicked will reveal a hidden image individually. The point of the game is to find the matching pictures (simple enough).
On the easiest level, I have 16 picture boxes. The number of picture boxes increases as the difficulty increases.
For each picture box, I currently have an event handler as follows (default created by visual studio):
Private Sub pictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pictureBox1.Click
pictureBox1.Image = (My.Resources.picture_name)
Private Sub pictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles pictureBox1.Click, pictureBox2.Click, pictureBox3.Click, ... pictureBox16.Click
' Change appropriate picture box
To find out which PictureBox was clicked you just have to look at the sender variable. Obviously you have to convert it from the Object type to the PictureBox type:
Dim ClickedBox As PictureBox ClickedBox = CType(sender, PictureBox)