Accessing controls on the ComponentTray

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

It seems that controls that are in a form's ComponentTray (e.g. ToolTip,
ErrorProvider) don't appear on its list of controls (FormName.Controls). Is
there any way I can get hold of them?
 
Hi,

"Controls" in component tray are components :). Try with components variable
that is in your form class (private System.ComponentModel.IContainer
components).
 
Thanks for the advice, Peter, but I'm not too sure how I should go about
this. To get the controls, I would use:

For Each c as Control in myForm.Controls

What would I use to get at these components?

Thanks,
 
You can use components.Components to get ComponentCollection and you can go
through each component.
 
Thanks, Peter - that seems to do it.

I'd found another way (using reflection), but this seems simpler.

Thanks again,
 
Back
Top