Having struggled with this for a while, I thought I’d share a solution I’ve discovered. Sorry if this is obvious to others.
I have a container control called ccWebSelectorItem which contains a label and an Image.
I am programmatically adding instances of ccWebSelectorItem to another container control called ccWebSelector using the EmbedWithin function.
On the ccWebSelector class I have a method called ItemClick which records which ccWebSelectorItem was clicked.
On the ccWebSelectorItem class, I am responding the label MouseUp event. What I wanted to achieve was to call ccWebSelector.ItemClick method from the MouseUp event of the label on the ccWebSelectorItem, and pass in the parent ccWebSelectorItem of the label.
(I hope you can follow all that!)
Here’s what I did.
In the MouseUp event of the label I put:
ccWebSelector(Me.Parent.Parent).ItemClick(ccWebSelectorItem(Me.Parent))
Simple! But not obvious.
Any alternative solutions would be gratefully received.