Click here to Skip to main content
15,886,705 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem about debuging Pin
MIHAI_MTZ6-Aug-07 4:12
MIHAI_MTZ6-Aug-07 4:12 
GeneralRe: Problem about debuging Pin
kcynic7-Aug-07 15:18
kcynic7-Aug-07 15:18 
GeneralRe: Problem about debuging Pin
kcynic7-Aug-07 19:10
kcynic7-Aug-07 19:10 
QuestionGet vs Post Pin
_AnsHUMAN_ 6-Aug-07 2:29
_AnsHUMAN_ 6-Aug-07 2:29 
QuestionDatabase and XSLT Pin
Prashant C6-Aug-07 2:12
Prashant C6-Aug-07 2:12 
AnswerRe: Database and XSLT Pin
lmoelleb6-Aug-07 7:40
lmoelleb6-Aug-07 7:40 
QuestionWhen should i use ?? Timer vs Thread.Sleep(int); Pin
Abdul Gafoor6-Aug-07 2:11
Abdul Gafoor6-Aug-07 2:11 
AnswerRe: When should i use ?? Timer vs Thread.Sleep(int); Pin
Luc Pattyn6-Aug-07 2:18
sitebuilderLuc Pattyn6-Aug-07 2:18 
Hi,

it is slightly more complex:
- you can use timers to get a single activation in future, or a periodic activation;

- the timer fires its event on some thread; for a Windows.Forms.Timer that would be
the main or GUI thread; for other timers, it is a different thread (which is good since
it does not load the GUI thread, but it also makes you need Control.InvokeRequired
and Controle.Invoke() if the timer's handler needs to touch some Control).

- you can use Thread.Sleep() to put the current thread to sleep for some time, but only
if that is acceptable to the thread. It is probably OK to do it in a worker thread
or background thread, and not in the main thread (aka "GUI thread") since during the
sleep the entire GUI comes to a halt, so it would not repaint when uncovered, you would
not be able to resize it, etc etc.

So, if you have things to do on the GUi thread thar must be kept apart in time, you
have to organize that without Trhead.Sleep(); in that case a Windows.Forms.Timer is
the right choice.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]


this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google


GeneralRe: When should i use ?? Timer vs Thread.Sleep(int); Pin
Pete O'Hanlon6-Aug-07 3:21
mvePete O'Hanlon6-Aug-07 3:21 
GeneralRe: When should i use ?? Timer vs Thread.Sleep(int); Pin
Malcolm Smart6-Aug-07 3:27
Malcolm Smart6-Aug-07 3:27 
GeneralRe: When should i use ?? Timer vs Thread.Sleep(int); Pin
Pete O'Hanlon6-Aug-07 3:34
mvePete O'Hanlon6-Aug-07 3:34 
JokeRe: When should i use ?? Timer vs Thread.Sleep(int); Pin
Luc Pattyn6-Aug-07 3:54
sitebuilderLuc Pattyn6-Aug-07 3:54 
GeneralRe: When should i use ?? Timer vs Thread.Sleep(int); Pin
Pete O'Hanlon6-Aug-07 4:01
mvePete O'Hanlon6-Aug-07 4:01 
QuestionTreeView StateImageList StateImageIndex Pin
Abisodun6-Aug-07 2:00
Abisodun6-Aug-07 2:00 
AnswerRe: TreeView StateImageList StateImageIndex Pin
Abisodun6-Aug-07 3:41
Abisodun6-Aug-07 3:41 
QuestionAutomatical start up Pin
Albu Marius6-Aug-07 1:18
Albu Marius6-Aug-07 1:18 
AnswerRe: Automatical start up Pin
Pete O'Hanlon6-Aug-07 1:33
mvePete O'Hanlon6-Aug-07 1:33 
GeneralRe: Automatical start up Pin
Albu Marius6-Aug-07 1:36
Albu Marius6-Aug-07 1:36 
AnswerRe: Automatical start up Pin
Hessam Jalali6-Aug-07 1:37
Hessam Jalali6-Aug-07 1:37 
AnswerRe: Automatical start up Pin
Nouman Bhatti6-Aug-07 1:54
Nouman Bhatti6-Aug-07 1:54 
AnswerRe: Automatical start up Pin
Vasudevan Deepak Kumar6-Aug-07 1:57
Vasudevan Deepak Kumar6-Aug-07 1:57 
QuestionDetecting Key Presses Pin
JamesBarnes6-Aug-07 1:13
JamesBarnes6-Aug-07 1:13 
AnswerRe: Detecting Key Presses Pin
Luc Pattyn6-Aug-07 1:24
sitebuilderLuc Pattyn6-Aug-07 1:24 
GeneralRe: Detecting Key Presses Pin
JamesBarnes6-Aug-07 1:29
JamesBarnes6-Aug-07 1:29 
GeneralRe: Detecting Key Presses Pin
JamesBarnes6-Aug-07 1:31
JamesBarnes6-Aug-07 1:31 

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.