I am developing a Windows Form Application as a subscriber for my WCF Publish Subscribe Service. The windows form application would have a combo box that acts as a filter for 2 types of fruits, Apple and Orange.
Mainly 3 choices would be given in the combo box.
- All Fruits
- Apple
- Orange
The fruits are all displayed in a Flow Layout panel that contains individual panels for each individual fruits. Hence when clicking all fruits, the flowlayoutpanel will create a flowlayoutpanel that contains every single panels of all fruits. (e.g. 4 fruits = 4 panels)
when the publisher publish a new type of food to the application, my filter for my combo box does not works anymore. (clicking the difference choices in the combo box does not filter the panels anymore) During publishing, i simply repopulate the list of fruits through a populateList() method and by using the following code
flowLayoutForFruit = createFlowLayoutPanel(1);
this.Controls.Add(flowLayoutForAlert);
As for the method ,createFlowLayoutPanel(integer type), it has basically 3 types of it.
- 1 – Both Types of Fruits
- 2 – Apple
- 3 – Orange
Since I am publishing a new post, I would just set the default view as all types of fruits, hence for the creation of type 1. Did the publishing of the new post screw up the event handler of the combo box or something?
All it takes was just adding a line of code to dispose the panels before adding it again.