Raising Events Between User Controls

G

Guest

I have 2 user controls on a form.
One control has a textbox and a button.
The other has a textbox.
When the user clicks the button on the first control I want the text to
appear in the other controls text box.

Can anyone point me in the right direction here ?
I know that I must raise an event on the parent for but am a bit lost.

Thankyou in advance
 
A

Alexander Ogol

I have 2 user controls on a form.
One control has a textbox and a button.
The other has a textbox.
When the user clicks the button on the first control I want the text to
appear in the other controls text box.

Can anyone point me in the right direction here ?
I know that I must raise an event on the parent for but am a bit lost.

It's better not to store data in control, but to bind them both to the same
variable.
In your simple case, you should just add event to button (double click on
"Click" event in the Properties), and do your business logic in this code.
There are a tons of variants. Choose your best. Go through the way "Basic
OOP book => MVC => how to make GUI right" ;)
 

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