Hi Friends,
I'm using .Net1.1.
The SelectedIndexChanged event is generated twice when i change the
selection. I think this is because the event is triggered when an
item
loses focus and the other item gains focus.
I want this event to be triggered only once.
Plz help me in solving this problem...
Thanks in advance....
Regards
ArunDhaJ
Morten Wennevik [C# MVP] - 31 Aug 2007 15:46 GMT
> Hi Friends,
>
[quoted text clipped - 11 lines]
> Regards
> ArunDhaJ
A solution to secondary events is using a flag or similar that lets you detect if the event has been handled or not.

Signature
Happy coding!
Morten Wennevik [C# MVP]
Stanimir Stoyanov - 31 Aug 2007 16:14 GMT
> The SelectedIndexChanged event is generated twice when i change the
> selection. I think this is because the event is triggered when an
> item
> loses focus and the other item gains focus.
> I want this event to be triggered only once.
By default the event is raised only once, when the new item gains focus, so
this is unlikely to be the cause. You can check if you have manually
attached a handler to the event. Removing it would be the best solution.
EventHandlers are attached using the syntax: "listView.SelectedIndexChanged
+= new EventHandler(...);".
Best Regards,
Stanimir Stoyanov
www.stoyanoff.info | www.aeroxp.org