Click here to Skip to main content
15,892,072 members
Home / Discussions / C#
   

C#

 
QuestionCompile Pin
 Programmer.18-May-08 20:48
 Programmer.18-May-08 20:48 
AnswerRe: Compile Pin
Rajesh R Subramanian18-May-08 20:57
professionalRajesh R Subramanian18-May-08 20:57 
AnswerRe: Compile Pin
Guffa18-May-08 21:07
Guffa18-May-08 21:07 
Questiondisplay message or alarm when table have new row? Pin
Mr.Kode18-May-08 20:07
Mr.Kode18-May-08 20:07 
AnswerRe: display message or alarm when table have new row? Pin
John_Adams18-May-08 23:00
John_Adams18-May-08 23:00 
AnswerRe: display message or alarm when table have new row? Pin
Vikram A Punathambekar19-May-08 0:05
Vikram A Punathambekar19-May-08 0:05 
AnswerRe: display message or alarm when table have new row? Pin
Mr.Kode19-May-08 0:53
Mr.Kode19-May-08 0:53 
QuestionUnsubscribing from the MouseMove event <i>from inside the handler...</i> Pin
Edmundisme18-May-08 20:02
Edmundisme18-May-08 20:02 
What's the explanation for why this doesn't work? What I'm after is a MouseMove handler that does not get called as a result of my programmatic mouse moves. (I know there aren't a lot of good reasons to move the cursor programmatically. This is just an example. I'm after the theory here).

The result of this code is that the MouseMove handler is continuously called (as a result of the code that moves the mouse in the MouseMove handler). But why doesn't unsubscribing from the event prior to moving the mouse keep the handler from being called?

private void OnMouseMove(object sender, MouseEventArgs e)
{
   // Unsubscribe from the MouseMove event because we don't want to respond to our programmatic mouse move.
   this.MouseMove -= OnMouseMove;
   // Move the mouse one pixel to the right just for kicks...
   Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
   // OK, hook it back up.
   this.MouseMove += OnMouseMove;
}


My best guess is that this is a threading issue. If that's the case, any ideas on how to fix it? Any ideas?

Thanks!

Ian
AnswerRe: Unsubscribing from the MouseMove event from inside the handler... Pin
stancrm18-May-08 20:22
stancrm18-May-08 20:22 
GeneralRe: Unsubscribing from the MouseMove event from inside the handler... Pin
Edmundisme19-May-08 6:50
Edmundisme19-May-08 6:50 
Questionport occupied Pin
George_George18-May-08 18:59
George_George18-May-08 18:59 
AnswerRe: port occupied Pin
dan!sh 18-May-08 20:57
professional dan!sh 18-May-08 20:57 
GeneralRe: port occupied Pin
George_George18-May-08 21:18
George_George18-May-08 21:18 
GeneralRe: port occupied Pin
leppie19-May-08 2:33
leppie19-May-08 2:33 
GeneralRe: port occupied Pin
George_George19-May-08 2:38
George_George19-May-08 2:38 
QuestionAbout checkBox of datagrid Pin
Prabhat00318-May-08 18:57
Prabhat00318-May-08 18:57 
AnswerRe: About checkBox of datagrid Pin
That's Aragon18-May-08 19:36
That's Aragon18-May-08 19:36 
GeneralRe: About checkBox of datagrid Pin
Prabhat00318-May-08 20:13
Prabhat00318-May-08 20:13 
GeneralRe: About checkBox of datagrid Pin
That's Aragon18-May-08 20:30
That's Aragon18-May-08 20:30 
GeneralRe: About checkBox of datagrid Pin
Prabhat00318-May-08 21:02
Prabhat00318-May-08 21:02 
GeneralRe: About checkBox of datagrid Pin
dan!sh 18-May-08 21:18
professional dan!sh 18-May-08 21:18 
GeneralRe: About checkBox of datagrid Pin
Prabhat00318-May-08 23:13
Prabhat00318-May-08 23:13 
GeneralRe: About checkBox of datagrid Pin
dan!sh 19-May-08 1:33
professional dan!sh 19-May-08 1:33 
GeneralRe: About checkBox of datagrid Pin
Prabhat00319-May-08 1:47
Prabhat00319-May-08 1:47 
QuestionDownload app Pin
sujithkumarsl18-May-08 18:52
sujithkumarsl18-May-08 18:52 

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.