Maybe it's a noob question ... anyway, I create a dynamic number of PictureBox controls.
I keep them inside a List.
What I want now is to make them clickable: same event handler for all (opening of the image source file) with a parameter.
The question is: how can I do it in practice?
How I set the handler Sub for every picbox?
Thanks a lot
Private Sub MethodThatCreatesDynamicPictureBoxes()
'Your code for dynamically creating picturebox
AddHandler yourPicBox.Click, AddressOf picbox_Click
Private Sub picbox_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Every time a picturebox is clicked, this variable will contain THAT picturebox
Dim picBox As PictureBox = DirectCast(sender, PictureBox)
'Do something with the picBox control