Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Forms application, how to communicate between custom controls?

I have three user controls. Here are the description of them: 1) First user control(ucCountry) contains combobox which displays country names from an xml file.

2) Second user control(ucChannelType) contains two radio buttons one to select TV and other to select Radio Channel Type.

3) Third usercontrol(ucChannels) will populate all the channels where country name is provided by ucCountry and type provided by ucChannelType

Now, how to communicate between these user control in a form. I need to decouple the usercontrols from the form. So, I need to use events. But if ucCountry fires an event (say CountryChanged event) and ucChannels subscribe the event, how to get the channel type from ucChannelType.

Thanks in advance...

like image 794
Manish Gupta Avatar asked Oct 15 '22 08:10

Manish Gupta


1 Answers

best solution is to add properties to your custom controls. there may be no fields in background, the getters will just get data from property of internal standard control.

like image 61
Andrey Avatar answered Nov 15 '22 06:11

Andrey