Solved

event registration

Posted on 2013-10-30
2
271 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now