Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ListBox problems
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00992047
Message ID:
00992079
Vues:
28
>I ran into some more problems related to my ListBox.
>I have a listbox on my form. I have set the listbox's datasource to a collection class object.
>I added a delete button with the follwoing code to delete an entry from the listbox:
>
>this.oIndividualDelayCollection.Remove(this.oIndividualDelayCollection[this.lstIndividualDelay.SelectedIndex]);
>this.lstIndividualDelay.DataSource = null;
>this.lstIndividualDelay.DataSource = this.oIndividualDelayCollection;
>
>
>Now lets assume that I have 3 items in my listbox (and in the collection object)
>Considder the following scenarios:
>1. I select the first element in the listbox and press the delete button. Element is deleted from the collection object and disapears from the listbox as expected and I can navigate between the remaining two items in the listbox.
>
>2. I select the 3rd item in the listbox and press the delete button. Element is deleted from the collection object and disapears from the listbox as expected, BUT I can not navigate between the remaining two elements of the listbox. Trying to click an element in the listbox throws an error and I can't find where the error is thrown from even when I step through with the debugger.
>
>Any help would be appreciated.
>
>Thanks,
>Einar

Einar,

I can't test this right now, but you may need to reset the SelectedIndex:
this.lstIndividualDelay.SelectedIndex = 0;
HTH,
Chad
_________________________________
There are 2 types of people in the world:
    Those who need closure
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform