C#-APP:need help with the sleep function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • benhania
    New Member
    • Jul 2008
    • 5

    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
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    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.

    Comment

    • benhania
      New Member
      • Jul 2008
      • 5

      #3
      ok... then how do i fix it?

      Comment

      • IanWright
        New Member
        • Jan 2008
        • 179

        #4
        Originally posted by benhania
        ok... then how do i fix it?
        You could call Application.DoE vents(); just before entering your Thread.Sleep();

        Comment

        Working...