Solved

event registration

Posted on 2013-10-30
2
281 Views
Last Modified: 2013-10-31
hi - I have a winform application and .net 4, using VS2010. the application uses a tab control to organize itself. all the code is written around which tab you're on and each tab runs a method as it is loads. the load method queries a database and draws the appropriate number of controls as it loads. since some of the controls are dependent on the query, I have to create them on entry and refer to them in the code using winhandles. as part of the process I also register an event for the controls. so, my question is two fold - is there any harm in having the same event be registered multiple times (each time the tab is invoked?); and after an indeterminate length of time, the binding between the event and the event handler seems to drop. any idea why?
should I be disposing of the controls as I leave the tab?
thanks.
0
Comment
Question by:jdcoburn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 39611299
>>is there any harm in having the same event be registered multiple times
Apart from the obvious one - for the one event many pieces of code will be run.

For the other question about the binding being dropped - I've no idea why you experience that.
0
 

Author Closing Comment

by:jdcoburn
ID: 39613979
ok - I think you answered the question I should have asked - each time the event is registered it creates a new copy which results in multiple passes through the code.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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