How to select an item in ListBox without firing SelectedIndexChang

G

Guest

hi,
a ListBbox is populated with 10 items. whenever the user selects an item in
the ListBox, some actions take place and eventually removes that selected
item from the ListBox and again displays the ListBox.

After deleting an item, I wish to highlight(selection) the next item below
it. After that, the ListBox has to be displayed. What I have to do for that?

Currently I am using the SelectedIndexChanged Event of ListBox. So whenever
i select the next item programatically, the further actions also happens as
if the user has selected another item.

Regards,
Hari
 
D

Daniel Moth

You could remove the eventhandler, programmatically select an item and then
reattach the event handler...

You could have a flag which you toggle before and after selecting an item
programmatically; in your event handler check for the flag and exit/return
as appropriate

I am sure there are other workarounds but any of the above will do...

Cheers
Daniel
 
G

Guest

Thank you so much Daniel

Daniel Moth said:
You could remove the eventhandler, programmatically select an item and then
reattach the event handler...

You could have a flag which you toggle before and after selecting an item
programmatically; in your event handler check for the flag and exit/return
as appropriate

I am sure there are other workarounds but any of the above will do...

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top