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
Jump to Post
Private Sub MethodThatCreatesDynamicPictureBoxes() 'Your code for dynamically creating picturebox AddHandler yourPicBox.Click, AddressOf picbox_Click End Sub 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 …
All 3 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.