By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,916 Members | 1,317 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,916 IT Pros & Developers. It's quick & easy.

Fire Button click event from another form in 2005

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.