Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ComboBox.DataSource
Message
De
12/08/2005 10:17:19
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01040543
Message ID:
01040547
Vues:
15
Just a guess, Einar ... but did you already have the DataSource set, then added a new item to the collection?

~~Bonnie



>I found this a little odd this morning. Considder the code below:
>
>
>this.oXPortCollection.Add(oXPrt);
>
>// Without the line below the new item added above does not show up in the combobox
>this.cboSboxes.DataSource = null;
>
>this.cboSboxes.DataSource = this.oXPortCollection;
>
>
>At first I did not have the line setting the DataSource to null but without that line the combobox did not display the newly added item to the collection. I added the collection to the watch window and could see that the new item was in there. I also wrote to the console all the items in the collection.
>
>Why do I have to set the DataSource to null first?
>
>I also experimented with code where I created a new collection, added the new item then looped through the old collection and added all the items from the old collection to the new collection. Then I set the old collection to equal the new collection and set the combobox' datasource to the old collection, in that case I did not have to set the datasource to null first.
>
>Any thoughts.
>
>Thanks,
>Einar
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform