Nick

Nick

  • NA
  • 1
  • 0

Sharing data between Custom Controls

Jan 19 2010 12:13 PM

Hi there,
I'm investigating converting a little app I wrote into a series of Custom Controls, to make it more reusable, but I've run into a bit of a "best practice" situation, as I'm fairly new to .Net I was wondering if someone can offer some advice.
The app is a standard Windows Form Application in C#.Net which uses a bunch of WebReferences to call SOAP services hosted elsewhere, all fairly simple stuff really.
The thing I'm not sure how best to approach is the fact that some of the Custom Controls are going to need to communicate, or at least talk to a common component to share information.  As a simple example imagine that you have a series of controls which all require some common piece of information, for example username.  Another example would be that one Custom Control sets some sort of context which is used by another, to use an email analogy someone selects a folder in one custom control, and the other needs to know about this to know which folder to display. I think ideally what I would like is to wrap up the WebReference handling code in a component/class which the other Custom Controls then use, it can store state which they set and pass it on to any others etc.
I've done a bit of reading, and the 2 things which looked similar to my requirements were Custom Datasources, and Extender Providers, however neither really fits properly, which leads me to think I'm on the wrong path!
Thanks, Nick

Answers (1)