Dim c = Args(0)
If Typeof c Is System.Windows.Forms.Control Then
Dim ctl As object
If c.HasChildren Then
For Each bc As object In c.controls
If Typeof bc Is C1.Win.C1FlexGrid.C1FlexGridBase OrElse Typeof bc Is WinForm.Table Then
ctl = bc
ElseIf Typeof bc Is C1.Win.C1Command.C1DockingTab Then
ctl = Functions.Execute("FindTable",bc.SelectedTab)
ElseIf Typeof bc Is System.Windows.Forms.SplitContainer Then
ctl = Functions.Execute("FindTable",bc.Panel1)
If ctl Is Nothing Then ctl = Functions.Execute("FindTable",bc.Panel2)
Else
ctl = Functions.Execute("FindTable",bc)
End If
If ctl IsNot Nothing AndAlso ctl.Focused Then Return ctl
Next
End If
End If
Return Nothing