Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection as DataSource in ListBox
Message
De
28/02/2005 14:38:45
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00990658
Message ID:
00991320
Vues:
14
Is anything data bound?

~~Bonnie


>Bonnie,
>I think I figured out what is wrong, but I can't explain it <s>
>I removed the listbox from my form and then added a brand new listbox with the same name as the old listbox. Then I ran the app and things were working great, except I forgot to add the code for SelectedIndexChanged. So I added the code in SelectedIndexChanged and things went back to not working, i.e. not refreshing. He is the code I added for the SelectedIndexChanged of the listbox:
>
>
>private void lstIndividualDelay_SelectedIndexChanged_1(object sender, System.EventArgs e)
>		{
>			this.txtIncludeDelay.Text = this.oIndividualDelayCollection[this.lstIndividualDelay.SelectedIndex].IncludeDelay.ToString();
>			this.txtIncludeFile.Text = this.oIndividualDelayCollection[this.lstIndividualDelay.SelectedIndex].IncludeFile.ToString();
>		
>		}
>
>
>I don't understand what these two lines of code could mess anything up.
>
>Einar
>
>
>>So, let's see your other code ... the code where you add something to the collection and reset the ListBox DataSource. Also, if you have any code in the ListBox.SelectedIndexChanged() event handler.
>>
>>~~Bonnie
>>
>>
>>>Bonnie,
>>>I still can not get it to "refresh" even when setting the SataSource to null and then setting it back to my collection. I can see through the debugger that the values in the collection has changed. Something even more strange happend once I made the code change, the selected index in the listbox does not appear to change, i.e. the blue hightlighted row does not change, but the selectedindexchanged even fires. Very odd. I am starting to think that I might use a datatable instead <s>, but before I do I would still like to figure this out.
>>>Below is the code for the class and for the collection class. Please feel free to comment on both.
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