Re: ComboBox DataSource - on the fly changes?

Tech-Archive recommends: Speed Up your PC by fixing your registry



cj,

Instead of binding to an ArrayList, create a shell for the ArrayList
which implements IBindingList and binds to that.

Or, in .NET 2.0, use the generic BindingList class and bind to that.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"cj" <chriscsharp@xxxxxxxxxxxxxxxx> wrote in message
news:OVeSPdN1FHA.4064@xxxxxxxxxxxxxxxxxxxxxxx
>I have a ComboBox that I populate using a DataSource (an ArrayList of
>objects of the same type.)
>
> When I add and remove items in the data source array list, I can't get the
> list of items shown in the ComboBox to update automatically. I had
> trouble getting the DataSource to take when I first created this ComboBox
> (a few weeks ago), and the only way I found to get it to work is to set
> the Parent property (and then I handled the ParentChanged event and set
> the DataSource, DisplayMember, ValueMember, etc., there.
>
> Do I have to set the Parent every time I make changes to the DataSource to
> get the ComboBox to repopulate, or is there a better way?
>
> Thanks,
> cj
>


.



Relevant Pages

  • RE: Adding new Item to a data-bound ComboBox
    ... I don't know how to do it except adding the item to the datasource, ... deleting it. ... You can hold off on binding until they click the combobox ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Add blank item in databound ComboBox
    ... Before binding to the datasource, add a new row to the datasource that has ... Then bind. ... of items in a ComboBox that has a set datasource? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Bindinglist und DataGridView
    ... Jetzt binde ich die BL_Kategorien an eine ComboBox ... Und an SelectedValue wird ein weiterer CurrencyManager angehängt, ... Ein DataGridist bindet ebenso an eine eigene DataSource. ... Nun sollte nun mit der DataGridViewComboBoxColumn gleiches wie bei der ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • Re: Using a ComboBox selection to fill in other fields in form
    ... > The Name of the Combo Box is 'Item1Desc' It's DataSource is also ... > The name of the TextBox to be filled in is "Item1Rate". ... that is what the ComboBox and the field in the table used ...
    (microsoft.public.access.forms)
  • Re: ComboBox-DataSource ersten Wert nach Eingabe nicht automatisch setzen
    ... Liste gefiltert und die DataSource der ComboBox auf die gefilterte ... Private CBO As ComboBox ... End Sub ...
    (microsoft.public.de.german.entwickler.dotnet.vb)