Public Overridable Property ActiveControl() As Control
Get
Return GetFocusedControl(Me)
End Get
Set(ByVal value As Control)
If Not value.Focused Then
value.Focus()
End If
End Set
End Property
Private Function GetFocusedControl(ByVal parent As Control) As Control
If parent.Focused Then
Return parent
End If
For Each ctrl As Control In parent.Controls
Dim temp As Control = GetFocusedControl(ctrl)
If temp IsNot Nothing Then
Return temp
End If
Next
Return Nothing
End Function