How do I get the object type so I can directly cast to it? This is the ideal method I would like to execute:
Dim MyObjects As New List(Of Object)
For Each O As Object In GlobalFunctions.GeneralFunctions.FindControlsRecursive(MyObjects, Form)
    Select Case True
        Case TypeOf O Is MenuStrip Or TypeOf O Is ToolStripButton Or TypeOf O Is Panel Or TypeOf O Is Label Or TypeOf O Is ToolStripSeparator
            AddHandler DirectCast(O, O.GetType).Click, AddressOf GotFocus
    End Select
Next
I am trying to make the code more efficient so that I do not have to directly cast to a specified object type. Ex.:
Dim MyObjectsAs New List(Of Object)
For Each O As Object In GlobalFunctions.GeneralFunctions.FindControlsRecursive(MyObjects, Form)
    Select Case True
        Case TypeOf O Is MenuStrip
            AddHandler DirectCast(O, MenuStrip).Click, AddressOf GotFocus
        Case TypeOf O Is Panel
            AddHandler DirectCast(O, Panel).Click, AddressOf GotFocus
        Case TypeOf O Is ToolStripButton
            AddHandler DirectCast(O, ToolStripButton).Click, AddressOf GotFocus
        Etc...
    End Select
Next 
EDIT
To my knowledge, a ToolStripItem (ToolStripButton) is not a Control so I cannot use a List(Of Control) for this situation. When I first was using a list of controls, the toolstrip items were not being included. This is the first time I have used ToolStrip in an application so I never had a reason for not using List(Of Control) until now.
                        
All controls derive from
Control. Therefore, instead of using the typeObjectuseControl.Controlhas most of the members of these controls like aClickevent.Use
ControlinFindControlsRecursiveas well.See:
It turned out that you have some components not being controls. But you can still cast all controls to
ControlNote that
ToolStripItemincludesToolStripButton,ToolStripControlHost,ToolStripDropDownItem,ToolStripLabelandToolStripSeparator, since all of these components derive fromToolStripItem. You can see this in the Object Browser in Visual Studio:MenuStripis aControl. So, these two cases should cover most of your controls and components. If you find another component not covered here, search for its least derived base type featuring theClickevent, so that the new case covers as many components as possible.