Event triggered several times at once

Posted on 2005-05-12
Medium Priority
Last Modified: 2012-05-05
Why do the selectedIndexChanged-event on the ListBox trigg four times when I click an item in the list once?
How do I avoid that? Can I use another event?

Question by:Skjori
LVL 14

Assisted Solution

puranik_p earned 300 total points
ID: 13984595
I think, in your code your are changing th selection of the listbox which causes the event to trigger several times.

Author Comment

ID: 13984626
I don't think so because the event is not triggered at all before I click the item.
LVL 96

Accepted Solution

Bob Learned earned 600 total points
ID: 13985481
You can put a break point in the event handler, and when it reaches that point, look in the Call Stack, and find out where it is being called from in each of the four cases.

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

LVL 10

Assisted Solution

EBatista earned 600 total points
ID: 13987614
if this is asp.net app you could have declared the OnSelectedIndexChanged event in the html tab of the control and in the codebehind with an add handler method.
if the language is VB, check also the event procedure and look for an "Handles YourDropDownName.OnSelectedIndexChanged" text in the declaration of the procedure

Expert Comment

ID: 14016162
Set a break point in the event and catch it triggering several times.

Each time you enter break mode, check the Sender object. The Sender object may be different when you get the event when you think you shouldn't be getting it. Sometimes you can check the sender object type and selectively enter your method code based on the sender.

LVL 96

Expert Comment

by:Bob Learned
ID: 14017690
Hmmm, that advice sorta sounds familiar :)


Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question