Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

ListViews SelectedIndexChanged Event Options

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ArunDhaJ - 31 Aug 2007 13:56 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.