Results 1 to 4 of 4

Thread: For Cycle in pause for some seconds

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2007
    Posts
    104

    For Cycle in pause for some seconds

    Hello,
    I have a loop and I need that at the end of each step of the cycle that it sets in pause for a few seconds
    How?
    Report your software freeware, it's free

    http://intotheapp.blogspot.com

    a blog with only free software

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: For Cycle in pause for some seconds

    You could call Thread.Sleep, but that's going to lock up the app. It would be better not to use a loop at all, but rather use a Timer with an Interval of 2000 (milliseconds) and then execute one iteration in the Tick event handler.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2007
    Posts
    104

    Re: For Cycle in pause for some seconds

    thanks for the help,

    i'm tryng with create a thread and then put it on sleep

    the calling is done in this way

    vb Code:
    1. Dim t As Thread
    2.         t = New Thread(AddressOf Me.threadtDo)
    3.         t.Start()

    but from thread i try to do some operations and it gives me an error "cross-thread" ,
    becouse i invoke from that thread some form components...
    how i can solve this problem??
    Report your software freeware, it's free

    http://intotheapp.blogspot.com

    a blog with only free software

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: For Cycle in pause for some seconds

    Follow the CodeBank link in my signature and check out my Accessing Controls From Worker Threads post.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width