Referring to another control within class

I have a class with a number of controls in it. One might be a button, which when pressed does something to another control within the class. In the button’s action event, what is the right way to reference the other control. If I wanted the button to remove all rows in a listbox, would it be:

me.parent.mylistbox.DeleteAllRows ()

I haven’t found this properly described in teh doc (unless I’ve missed it).

[quote=266655:@Tim Streater]I have a class with a number of controls in it. One might be a button, which when pressed does something to another control within the class. In the button’s action event, what is the right way to reference the other control. If I wanted the button to remove all rows in a listbox, would it be:

me.parent.mylistbox.DeleteAllRows ()

I haven’t found this properly described in teh doc (unless I’ve missed it).[/quote]

From what you tell, it looks like a ContainerControl. In that case, no need for me.parent. Just like on a window, you can refer to all other controls on the CC directly by their name

mylistbox.DeleteAllRows ()

Note that rather than “me.parent”, you should simply use self to refer to the ContainerControl itself.

Ah. Yes, it is a CC. Good! Thanks for that.