468,101 Members | 1,346 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,101 developers. It's quick & easy.

C#-APP:need help with the sleep function

hello

i have a problem with the thread.sleep function - when i make a commend (in windowns form app) and after it i use the sleep function the thread first pause and only then execute all the commends in the method, even the ones that come before the thread.sleep .

is that supposed to haapen or its a bug or something?
if there is a better way to pause an app please tell me.

thenx
Jul 18 '08 #1
3 1604
Plater
7,872 Expert 4TB
I am willing to bet that it DID execute the commands that came before the thread.sleep(), but that the gui didn't get to update itself until after the thread.sleep() so it looks like it executes them afterwards.
Jul 18 '08 #2
ok... then how do i fix it?
Jul 18 '08 #3
IanWright
179 100+
ok... then how do i fix it?
You could call Application.DoEvents(); just before entering your Thread.Sleep();
Jul 18 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Radioactive Man | last post: by
4 posts views Thread by coolsti | last post: by
5 posts views Thread by Sinan Nalkaya | last post: by
2 posts views Thread by The Last Ottoman | last post: by
6 posts views Thread by George Sakkis | last post: by
1 post views Thread by =?Utf-8?B?QU1lcmNlcg==?= | last post: by
2 posts views Thread by Steve | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.