Hola Jos?,
You should use the Usercontrol. Of course, the UserControl is a unit despite
its constituents and Form.ActiveControl returns the UserControl when it is
the active control. And of course you can not override the ActiveControl
property of the UserControl because it knows quite well which constituent
control is the active one, while you could cheat...
What you can do is to take into account if the active control of the form is
a UserControl and in that case to query the ActiveControl of the
UserControl. For example, put your usercontrol and a timer on a form and
paste this code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If TypeOf Me.ActiveControl Is UserControl Then
Me.Text = DirectCast(Me.ActiveControl,
UserControl).ActiveControl.Name
Else
Me.Text = Me.ActiveControl.Name
End If
End Sub

Signature
Carlos J. Quintero (Visual Developer - .NET MVP)
FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
addins:
http://groups.yahoo.com/group/vsnetaddin/ (free join)
> Hi,
> I was able to create my component based on UserControl; however, i need the
> ActiveControl property of the component to still give the correct result.
> For instance, if i have three textboxes in my component and i query the
> ActiveControl of the form i need it to tell me which box has the focus (not
> to tell me that my component has the focus).
Jos? Araujo - 01 Sep 2004 16:32 GMT
Thanks for your answer...
I think i will be forced to use the UserControl. However, in my case it
would be better to use Control class...
What happens is that I do need to know which is the actual activecontrol.
This user control that i am creating is not a real one, it is just a hack to
make my program easily to develop (since it is more granural, more people
can work on it at the same time), and faster to load (both at run-time and
design-time).
We have developed a set of "ScreenSystem" classes that lets us customize the
behavior/look of our forms on runtime, if the usercontrol that i am creating
does not return the correct ActiveControl that creates problem for me.
Another point is: it would be really nice to just know how VS.NET tells the
difference between something that should show the Form designer and
somethign that should show the Component Designer. I was reading about it
and I do NOT find classes that are document in the help files like:
System.Windows.Forms.Design.ControlDesigner, which i think is the one that
i need to use (or a child of it).
Anyways, i think i am going to use the tweak you propouse... Thanks for your
help... Jos?.
> Hola Jos?,
>
[quoted text clipped - 29 lines]
> (not
> > to tell me that my component has the focus).