Multiple ComboBox Display Issue RRS feed

  • Question

  • I have a windows form application with three dependant comboboxes. 
    The comboboxes are using an ArrayList as a datasource.  Each box has it's own.
    The first comboBox (Unit) is the main driver.  SqlDataReader provides the dataelements for the ArrayList.
    The second ComboBox (Comp) is dependant on the results from (Unit).

    It works the first time.  I can select from (Unit) and then using the Validated event, populate (Comp). I can select from (Comp).  Everything works.

    The second time I change (Unit).  After the Validated event fires the (Comp) box becomes invisible (when using Visible attribute) and will not show, but the Corner button still works and the drop-down list still shows.

    On the second time, not using Visible attribute, the  (Comp) box will act like it is working but will stick on the last entry (text area) and the drop-down list will show but not highlight.
    The boxes are anchored to top, left,right.  When the form resizes, the box does not resize, but the drop-down list button works on where it should be.

    I have tried to just clear the ArrayList underneath, I have tried setting DataSource=null;
    I still have the same issue.  
    I really could use some help here.
    Friday, November 4, 2005 12:50 AM


  • On dependent data related controls I did had similar issues.  What I have done is to "drop" or clear the data-bindings load the parent control with its new values and reestablish the databinding.  Take a look at the "DataBindings" control property and the following methods:

    DataBindings.Clear()  // clear bindings
       <source-data-member-to-bind-to>)  // to add a binding

    Hope this helps.
    Saturday, November 5, 2005 1:18 PM