Fire Button click event from another form in 2005

R

Rick

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.
 
R

Ryan

FormB frm = new FormB();
SetParent(frm.Handle, this.Handle);

Button btn = frm.btnFire;
this.InvokeOnClick(btn, EventArgs.Empty);
 
R

Ryan

I completely agree with you; will do next time.

Peter Duniho said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top