Results 1 to 7 of 7

Thread: [ask] about backgroundworker

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2008
    Posts
    146

    [ask] about backgroundworker

    i have a code like this

    Code:
    timer1_tick.....
          backgroundworker1.runsynworker
    if x = 10 then
      timer1.stop
    end
    timer1.interval = 600

    the question is
    sometimes i run this code there's no error
    but other times there's an error backgroundworker1 is busy...

    why it can happen????

    how to solve it become no more error with the fix timer interval....

    thx

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [ask] about backgroundworker

    you get that error because the background worker is still processing something...
    The only thing you can do that I know of is to just check the IsBusy property of the backgroundworker before calling it again.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: [ask] about backgroundworker

    Just out of curiousity, what are you calling in the background worker that needs to be called 10 times in intervals of 600ms??

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2008
    Posts
    146

    Re: [ask] about backgroundworker

    Quote Originally Posted by MaximilianMayrhofer
    Just out of curiousity, what are you calling in the background worker that needs to be called 10 times in intervals of 600ms??
    just the complex calculation of math

    how to solve it become no more busy???

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

    Re: [ask] about backgroundworker

    You're going to have to give far more detail than that. Either you should just be running the BackgroundWorker once and doing all the work in that one run or you shouldn't be using it at all.
    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

  6. #6
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: [ask] about backgroundworker

    This is for a game, isn't it?

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Apr 2008
    Posts
    146

    Re: [ask] about backgroundworker

    Quote Originally Posted by MaximilianMayrhofer
    This is for a game, isn't it?
    no it's not

    it's an hash program

    thx

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