471,356 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Fire Button click event from another form in 2005

I have a form FormA with a button Button1; I use SetParent(FormB.Handle,
this.Handle) to load FormB inside FormA. FormB also has a button Button1
which displays a messagebox.
When Button1 is clicked on FormA; i would like the Button2 click event on
FormB to be fired up and display the messagebox.
How do I do it? will appreciate some sample code.
Aug 1 '08 #1
5 1990
Never mind, i've got the answer.

"Rick" wrote:
I have a form FormA with a button Button1; I use SetParent(FormB.Handle,
this.Handle) to load FormB inside FormA. FormB also has a button Button1
which displays a messagebox.
When Button1 is clicked on FormA; i would like the Button2 click event on
FormB to be fired up and display the messagebox.
How do I do it? will appreciate some sample code.
Aug 1 '08 #2
On Fri, 01 Aug 2008 08:06:01 -0700, Rick <Ri**@discussions.microsoft.com>
wrote:
Never mind, i've got the answer.
It is customary and polite, when you have found the answer to your own
question, to post that answer to the newsgroup where you asked the
original question. That way, if someone else has the same question later,
they can find the answer to it, instead of just the question.

Pete
Aug 1 '08 #3
How did you do it, Rick?

"Rick" wrote:
Never mind, i've got the answer.

"Rick" wrote:
I have a form FormA with a button Button1; I use SetParent(FormB.Handle,
this.Handle) to load FormB inside FormA. FormB also has a button Button1
which displays a messagebox.
When Button1 is clicked on FormA; i would like the Button2 click event on
FormB to be fired up and display the messagebox.
How do I do it? will appreciate some sample code.
Aug 1 '08 #4
FormB frm = new FormB();
SetParent(frm.Handle, this.Handle);

Button btn = frm.btnFire;
this.InvokeOnClick(btn, EventArgs.Empty);
"jp2msft" wrote:
How did you do it, Rick?

"Rick" wrote:
Never mind, i've got the answer.

"Rick" wrote:
I have a form FormA with a button Button1; I use SetParent(FormB.Handle,
this.Handle) to load FormB inside FormA. FormB also has a button Button1
which displays a messagebox.
When Button1 is clicked on FormA; i would like the Button2 click event on
FormB to be fired up and display the messagebox.
How do I do it? will appreciate some sample code.
Aug 6 '08 #5
I completely agree with you; will do next time.

"Peter Duniho" wrote:
On Fri, 01 Aug 2008 08:06:01 -0700, Rick <Ri**@discussions.microsoft.com>
wrote:
Never mind, i've got the answer.

It is customary and polite, when you have found the answer to your own
question, to post that answer to the newsgroup where you asked the
original question. That way, if someone else has the same question later,
they can find the answer to it, instead of just the question.

Pete
Aug 6 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Mark | last post: by
5 posts views Thread by Carlo Marchesoni | last post: by
2 posts views Thread by Sam Miller | last post: by
5 posts views Thread by Verde | last post: by
2 posts views Thread by eveready | last post: by
4 posts views Thread by Ty Salistean | last post: by
19 posts views Thread by Daniela Roman | last post: by
reply views Thread by XIAOLAOHU | 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.