Hi snesbit,
Thanks for your post.
Based on my understanding, the Toolbar on your main Form applicaiton may
fire certain event, and all the forms contained inside the main Form's
panel should react to this event.
I think for all the child forms, we can add an extra parameterized
constructor to it. Then when dynamically creating the child form in main
form's code, we can explicitly pass the main Form reference through the
parameter to the child form, in the child form, it can register the main
Form toolbar event in the parameterized constructor.
Then, whenever the toolbar event is fired, all the registered child forms
will react to this event without any problem. If I misunderstand you,
please feel free to tell me, thanks
Hope this helps.
===========================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Steve Nesbit - 26 Aug 2005 13:05 GMT
It sounds like an interesting approach. How can you register the mainform
toolbar events in the child?
> Hi snesbit,
>
[quoted text clipped - 25 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 29 Aug 2005 02:26 GMT
Hi Steve,
Thanks for your feedback.
Yes, if our ToolBar reference is private, we can not register the event
handler directly. For this, I have 2 options:
1. Create a public method in Base form. This method takes 1 parameter as
type [YourToolBarSpecific]EventHandler and registers Toolbar event in this
method, then in child Form, we can invoke this method with a valid
eventhandler. Sample code like this:
//In main form
public void ButtonAddHandler(EventHandler eh)
{
this.button1.Click+=eh;
}
private void button2_Click(object sender, System.EventArgs e)
{
Form2 f=new Form2(this);
}
//In child form
public Form2(Form1 f)
{
f.ButtonAddHandler(new EventHandler(f_Click));
InitializeComponent();
}
private void f_Click(object sender, EventArgs e)
{
MessageBox.Show("hehe");
}
2. Just modifiy the ToolBar modifier as public
Hope this helps
=====================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 31 Aug 2005 08:02 GMT
Hi Steve,
Does my reply make sense to you? Is your problem resolved? Please feel free
to tell me, thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.