I am making a game for my visual basic course. I have several boxes for images that, when clicked, will show the hidden image separately. The goal of the game is to find matching photos (fairly simple).
At the simplest level, I have 16 image boxes. The number of images increases with increasing complexity.
For each image window, I currently have an event handler (created by visual studio by default):
Private Sub pictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pictureBox1.Click
Internally, I plan to use this to change the image in the image window, as follows:
pictureBox1.Image = (My.Resources.picture_name)
I would like to know if there is a way for one auxiliary ALL descriptor to click a button and change the corresponding image block instead of 16 separate handlers. For instance:
Private Sub pictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles pictureBox1.Click, pictureBox2.Click, pictureBox3.Click, ... pictureBox16.Click
And do the following:
' Change appropriate picture box
Here's what it looks like (for now):

source share