471,603 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,603 software developers and data experts.

User Control MouseUp

Udi
Hi,
I have a user control - A that has a panel that contains
a list of a different user control - B.
When I'm adding a new B to A, I'm subscribing a handler
(which is a method of A) to B.MouseUp.
However, when I click B the event is not fired.

See example:
class A : System.Windows.Forms.UserControl
{
void OnButtonAddBctrl(...)
{
:
B ctrl = new B(...); // B is a UserControl
ctrl.MouseUp +=new MouseEventHandler(Bctrl_MouseUp);
this.panel1.Controls.Add(ctrl);
:
}

void Bctrl_MouseUp(...)
{
// Never getting here when clicking B
}
}

What is wrong?
Thanks!

Feb 7 '06 #1
1 3041
Udi
I think I know what my problem is -
the user control B is filled with a panel that contains a list of a
third user control - C.
So it seems like the panel "hides" the B from mouse events.
Do I need to pass (and subscribe) my handler to each and every one the
children of B( i.e the panel and all C's in it)?
Is there a way of doing it automatically?
Thanks.

Feb 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Mark Schwarz | last post: by
1 post views Thread by Alan | last post: by
1 post views Thread by coderjoe | last post: by
4 posts views Thread by =?Utf-8?B?RWl0YW4=?= | last post: by
reply views Thread by =?Utf-8?B?U2hhcm9u?= | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.