Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
GeneralRe: Memory leak Pin
HexaDeveloper8-Apr-07 7:12
HexaDeveloper8-Apr-07 7:12 
GeneralRe: Memory leak [modified] Pin
Luc Pattyn8-Apr-07 11:21
sitebuilderLuc Pattyn8-Apr-07 11:21 
GeneralRe: Memory leak Pin
HexaDeveloper8-Apr-07 12:43
HexaDeveloper8-Apr-07 12:43 
GeneralRe: Memory leak Pin
Luc Pattyn8-Apr-07 13:05
sitebuilderLuc Pattyn8-Apr-07 13:05 
QuestionGet Controls by name Pin
swjam4-Apr-07 5:03
swjam4-Apr-07 5:03 
AnswerRe: Get Controls by name Pin
B.King4-Apr-07 5:50
B.King4-Apr-07 5:50 
QuestionHow to specify an event handler Pin
peterchen4-Apr-07 5:02
peterchen4-Apr-07 5:02 
AnswerRe: How to specify an event handler Pin
mikanu4-Apr-07 6:48
mikanu4-Apr-07 6:48 
I've always used the first method (using the New operator to instantiate a new delegate that will handle the event).
You can alway declare a variable that holds the reference to the event handler in advance and then use that as your handler like so:

C#
<br />
<pre>   
   EventHandler eh;
   eh = New EventHandler(SomeEventHandler);
   a.SomeEvent += eh;
</pre><br />
<br />
this way you could later detach the event handler too, like so:<br />
<br />
<code lang="C#"><br />
<pre>
   a.SomeEvent -= eh; //(as long as eh still references your event handler!)
</pre><br />
<br />
The second way seems to be a shortcut for the first (in which the compiler automatically generates the code that instantiated the delegate and than passes it your function).<br />
<br />
Hope this helps, but your best bet is to do some reading on delegates and event handlers in C#. <br />
<br />
 <br />
<br />
<div class="ForumSig">----<br />
<a href="www.digitalGetto.com">www.digitalGetto.com</a></div>

QuestionMulti-select ComboBox Pin
Amatista4-Apr-07 4:46
Amatista4-Apr-07 4:46 
AnswerRe: Multi-select ComboBox Pin
Douglas Troy4-Apr-07 6:00
Douglas Troy4-Apr-07 6:00 
GeneralRe: Multi-select ComboBox Pin
Amatista4-Apr-07 22:27
Amatista4-Apr-07 22:27 
GeneralRe: Multi-select ComboBox Pin
Douglas Troy5-Apr-07 5:34
Douglas Troy5-Apr-07 5:34 
GeneralRe: Multi-select ComboBox Pin
Amatista10-Apr-07 2:27
Amatista10-Apr-07 2:27 
QuestionControl Draw delay on resize (Getting rid of it) Pin
Muntyness4-Apr-07 3:11
Muntyness4-Apr-07 3:11 
AnswerRe: Control Draw delay on resize (Getting rid of it) Pin
Stanciu Vlad4-Apr-07 7:52
Stanciu Vlad4-Apr-07 7:52 
QuestionMSI uninstall problems Pin
Vadim G.4-Apr-07 2:53
Vadim G.4-Apr-07 2:53 
AnswerRe: MSI uninstall problems Pin
Douglas Troy4-Apr-07 3:51
Douglas Troy4-Apr-07 3:51 
GeneralRe: MSI uninstall problems Pin
Vadim G.4-Apr-07 4:44
Vadim G.4-Apr-07 4:44 
Questionbind list with datagrid & textbox Pin
merwa4-Apr-07 2:43
merwa4-Apr-07 2:43 
AnswerRe: bind list with datagrid & textbox Pin
Not Active4-Apr-07 3:24
mentorNot Active4-Apr-07 3:24 
QuestionProblem Displaying moneyfield in gridview Pin
Bubbles24-Apr-07 1:56
Bubbles24-Apr-07 1:56 
AnswerRe: Problem Displaying moneyfield in gridview Pin
kubben4-Apr-07 2:31
kubben4-Apr-07 2:31 
AnswerRe: Problem Displaying moneyfield in gridview Pin
Hayder Marzouk4-Apr-07 2:33
Hayder Marzouk4-Apr-07 2:33 
GeneralRe: Problem Displaying moneyfield in gridview Pin
Bubbles24-Apr-07 3:11
Bubbles24-Apr-07 3:11 
GeneralRe: Problem Displaying moneyfield in gridview Pin
Hayder Marzouk4-Apr-07 4:05
Hayder Marzouk4-Apr-07 4:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.