C# – Sharing Data Between User Controls

ado.netcdesignervisual studiowinforms

How do I share data between user-controls in .Net, using ADO.net datasets, without ditching the designer? A simple example:

I have two separate user-controls; Control1, which contains a textbox, and Control2, which contains a label. Both the textbox and the label are bound (using the designer) to the same property in the same dataset. If I drag both Control1 and Control2 into the same form, I would expect that changing the textbox would change the label. However, it doesn't, since Control1 and Control2 have separate DataSets and BindingSources. I want to keep the textbox and label synchronized without having to ditch the designer and code the entire form by hand.

Thanks in advance for any help.

Best Answer

you can try using a relative source in your binding expression.