Click here to Skip to main content
16,017,638 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to safely Form.Invoke from another thread? Pin
michal.kreslik25-Jul-07 1:44
michal.kreslik25-Jul-07 1:44 
AnswerRe: How to safely Form.Invoke from another thread? Pin
Tormod Fjeldskaar25-Jul-07 1:50
Tormod Fjeldskaar25-Jul-07 1:50 
GeneralRe: How to safely Form.Invoke from another thread? Pin
michal.kreslik25-Jul-07 2:47
michal.kreslik25-Jul-07 2:47 
GeneralRe: How to safely Form.Invoke from another thread? Pin
Luc Pattyn25-Jul-07 7:29
sitebuilderLuc Pattyn25-Jul-07 7:29 
GeneralRe: How to safely Form.Invoke from another thread? Pin
michal.kreslik25-Jul-07 11:41
michal.kreslik25-Jul-07 11:41 
GeneralRe: How to safely Form.Invoke from another thread? Pin
Luc Pattyn25-Jul-07 12:15
sitebuilderLuc Pattyn25-Jul-07 12:15 
GeneralRe: How to safely Form.Invoke from another thread? Pin
michal.kreslik25-Jul-07 21:43
michal.kreslik25-Jul-07 21:43 
GeneralRe: How to safely Form.Invoke from another thread? Pin
michal.kreslik25-Jul-07 23:13
michal.kreslik25-Jul-07 23:13 
OK, so I resolved the issue. It's certainly not the most elegant solution, but it works. I will still appreciate if someone tells me how this should be done "professionally" Smile | :)

Instead of a lock, I'm using an ordinary while loop. The while loop has an advantage over lock of being able to execute something while it's waiting for a signal. Lock simply sits there and does nothing until the lock is released.

So I placed the while loop inside the Form.Closing() event handler. This while loop is blocking the form from closing itself (and thus disposing of itself). Inside this loop (apart from waiting for a signal) I'm executing Application.DoEvents() every 50 ms. This ensures that the Invoke, waiting on the second thread, gets processed.

If you've got some better suggestion, please tell me.

Thanks,
Michal
QuestionGROUP BY RECORD IN GRIDVIEW & EXPORT TO EXCEL Pin
krishanpanda25-Jul-07 1:07
krishanpanda25-Jul-07 1:07 
QuestionNeed VSD for asp.net case study Pin
Banjo Ayorinde25-Jul-07 1:05
Banjo Ayorinde25-Jul-07 1:05 
AnswerRe: Need VSD for asp.net case study Pin
UglyxXXx25-Jul-07 23:25
UglyxXXx25-Jul-07 23:25 
QuestionDataGridView Pin
sangramkp25-Jul-07 0:48
sangramkp25-Jul-07 0:48 
AnswerRe: DataGridView Pin
Tormod Fjeldskaar25-Jul-07 1:00
Tormod Fjeldskaar25-Jul-07 1:00 
Questiondatagrid focus Pin
praveenkumar palla25-Jul-07 0:45
praveenkumar palla25-Jul-07 0:45 
AnswerRe: datagrid focus Pin
Nouman Bhatti25-Jul-07 2:46
Nouman Bhatti25-Jul-07 2:46 
QuestionHiding Form after loading another Pin
Banjo Ayorinde25-Jul-07 0:12
Banjo Ayorinde25-Jul-07 0:12 
AnswerRe: Hiding Form after loading another Pin
Eduard Keilholz25-Jul-07 0:21
Eduard Keilholz25-Jul-07 0:21 
AnswerRe: Hiding Form after loading another Pin
PhilDanger25-Jul-07 3:51
PhilDanger25-Jul-07 3:51 
QuestionHiding Form after loading another Pin
Banjo Ayorinde25-Jul-07 0:09
Banjo Ayorinde25-Jul-07 0:09 
QuestionCreating a web based report in win app Pin
Banjo Ayorinde25-Jul-07 0:02
Banjo Ayorinde25-Jul-07 0:02 
Questionhoe to pass parameter in crystal report dynamically? Pin
help as an alias25-Jul-07 0:00
help as an alias25-Jul-07 0:00 
AnswerRe: hoe to pass parameter in crystal report dynamically? Pin
Nouman Bhatti25-Jul-07 2:54
Nouman Bhatti25-Jul-07 2:54 
GeneralRe: hoe to pass parameter in crystal report dynamically? Pin
help as an alias25-Jul-07 3:00
help as an alias25-Jul-07 3:00 
Questionmouse event Pin
cyn824-Jul-07 23:56
cyn824-Jul-07 23:56 
AnswerRe: mouse event Pin
Eduard Keilholz25-Jul-07 0:22
Eduard Keilholz25-Jul-07 0:22 

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.