Sharing BindingSource

Sharing BindingSource

Old forum URL: forums.lhotka.net/forums/t/5695.aspx


AndyW posted on Wednesday, October 29, 2008

 

Hi,

I have a form with two usercontrols, lets say one for company details (parent) and the other Contacts (children).

I have created my Business Classes and have successfully managed to databind on the form between text boxes (company details) and grid (contacts), everything works fine.

I have now decided to split the controls up into user controls, as I will be reusing both controls elsewhere in the application.

This is where my problem arises, how can I shares the BindingSource of usercontrol Company with usercontrol Contacts.

I hope I have made sense, any help would be appreciated.

Many Thanks

Andy

 

eulerthegrape replied on Wednesday, October 29, 2008

I could be way off base here and this may not apply if you're writing a web app...

I think you create a binding source in the containing form which holds these two controls and don't confine the controls to to a specific bindingsource beforehand.  Then set the datasource for the controls once you place them on the form.

-Euler

AndyW replied on Thursday, October 30, 2008


Thanks for the reply.

I worked very well, thanks.

Copyright (c) Marimer LLC