Click here to Skip to main content
15,905,679 members
Home / Discussions / C#
   

C#

 
QuestionSaving only time from datetimepicker in Sql server Pin
majidbhutta21-Nov-05 2:20
majidbhutta21-Nov-05 2:20 
AnswerRe: Saving only time from datetimepicker in Sql server Pin
Curtis Schlak.21-Nov-05 16:54
Curtis Schlak.21-Nov-05 16:54 
AnswerRe: Saving only time from datetimepicker in Sql server Pin
PraveenRockz [ Praveen Solanki ]12-Aug-10 23:25
PraveenRockz [ Praveen Solanki ]12-Aug-10 23:25 
QuestionWindows Installer. Pin
Illegal Operation21-Nov-05 1:11
Illegal Operation21-Nov-05 1:11 
AnswerRe: Windows Installer. Pin
Curtis Schlak.21-Nov-05 17:05
Curtis Schlak.21-Nov-05 17:05 
Questionhow to add module in c#.net Pin
sarayumadhavan21-Nov-05 1:07
sarayumadhavan21-Nov-05 1:07 
AnswerRe: how to add module in c#.net Pin
S. Senthil Kumar21-Nov-05 4:51
S. Senthil Kumar21-Nov-05 4:51 
QuestionShould you add and remove event handlers willy-nilly? Pin
Gizz21-Nov-05 0:32
Gizz21-Nov-05 0:32 
I have had an email from one of our equipment suppliers complaining that I am using event handlers incorrectly.

We have an app that uses MVC and switches in various controllers, forms, etc. As a form is switched in, it is attached to the relevant hardware and GUI events using the += syntax... when the form is switched out, the events are unbound using -=.

Now, I thought this was OK to do, but then I had this email from the supplier (modified to protect identities)

"You should only ever add/remove an event handler once in most applications. It is not designed by Microsoft to have event handlers added and removed continuously as a method to controlling these things. This is because an event handler is usually dealt with in another thread (or how else could it be generated for the application) and adding/removing notifications to the other thread can easily be the subject of racetrack timing errors."

Now, I'm pretty sure that adding and removing event handlers is thread safe, and even if it wasn't, I can't see how a 'racetrack' condition could occur. (Also, if the event was raised in the GUI thread, surely it will be handled in the GUI thread?)

So, may I ask the panel this question?

Is there a Microsoft publication somewhere that details the design philosophy behind the .Net 1.1 event handlers?

Thanks in advance!
Gizz.
AnswerRe: Should you add and remove event handlers willy-nilly? Pin
Robert Rohde21-Nov-05 1:06
Robert Rohde21-Nov-05 1:06 
GeneralRe: Should you add and remove event handlers willy-nilly? Pin
Gizz21-Nov-05 3:01
Gizz21-Nov-05 3:01 
GeneralRe: Should you add and remove event handlers willy-nilly? Pin
Robert Rohde21-Nov-05 7:48
Robert Rohde21-Nov-05 7:48 
AnswerRe: Should you add and remove event handlers willy-nilly? Pin
Charlie Williams21-Nov-05 7:32
Charlie Williams21-Nov-05 7:32 
AnswerRe: Should you add and remove event handlers willy-nilly? Pin
Leslie Sanford21-Nov-05 9:10
Leslie Sanford21-Nov-05 9:10 
QuestionHow to get embedded .jpeg from excel worksheet? Pin
Andrew Muliar21-Nov-05 0:30
Andrew Muliar21-Nov-05 0:30 
QuestionHow to minimize/maximize a borderless form from the taskbar PinPopular
tprashanth21-Nov-05 0:21
tprashanth21-Nov-05 0:21 
QuestionParse a word doc and update contents to database Pin
ranjithib120-Nov-05 22:14
ranjithib120-Nov-05 22:14 
AnswerRe: How to use C# to call a traditional unmanaged C++ DLL which has many functions with pointer parameters? Pin
Stanciu Vlad20-Nov-05 21:50
Stanciu Vlad20-Nov-05 21:50 
QuestionHow to use C# to call a traditional unmanaged C++ DLL which has many functions with pointer parameters? Pin
tsung-yu20-Nov-05 20:48
tsung-yu20-Nov-05 20:48 
AnswerRe: How to use C# to call a traditional unmanaged C++ DLL which has many functions with pointer parameters? Pin
RobstaHendricks23-Nov-09 5:53
RobstaHendricks23-Nov-09 5:53 
Question,F1 help in Windows App Pin
Stephen McAllister20-Nov-05 19:53
Stephen McAllister20-Nov-05 19:53 
Questionhow to download or upload a file using C# Pin
v.k.s20-Nov-05 17:09
v.k.s20-Nov-05 17:09 
AnswerRe: how to download or upload a file using C# Pin
Christian Graus20-Nov-05 17:15
protectorChristian Graus20-Nov-05 17:15 
QuestionGetChildAtPoint which is out of screen Pin
tsunsau71720-Nov-05 17:06
tsunsau71720-Nov-05 17:06 
QuestionC# inheritance Pin
ppp00120-Nov-05 16:53
ppp00120-Nov-05 16:53 
AnswerRe: C# inheritance Pin
Christian Graus20-Nov-05 17:10
protectorChristian Graus20-Nov-05 17:10 

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.