You are a expert, thank you, but if this code is in moulde sub, for example:
Public sub AAA(Byval FormName as Form)
For Each comp As System.ComponentModel.Component In
FormName.components.Components
' Tooltip and ContextMenuStrip will be found here
Next
End Sub
The code above will not work if replace "Me" with "FormName", why?
Thank you
"kimiraikkonen" <ki*************@gmail.com>
??????:f2**********************************@g17g20 00prg.googlegroups.com...
On Nov 10, 6:16 am, YXQ <Y...@discussions.microsoft.comwrote:
Me.Controls can get all the controls on the form, but i want to get all
the
controls include non-from controls, for example ToolTip,
ContextMenuStrip...
Thank you
I think because they don't inherit Control class, as a result they're
not identified as controls.
See which classes/interfaces they implement. For example ToolTip class
inherits Component class, not control:
http://msdn.microsoft.com/en-us/libr...s.tooltip.aspx
So, you can loop Components to get them as follows:
For Each comp As System.ComponentModel.Component _
In Me.components.Components
' Tooltip and ContextMenuStrip will be found here
Next
Hope this helps,
Onur Güzel