Results 1 to 5 of 5

Thread: [2.0] Background Worker Status [Resolved]

  1. #1

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    [2.0] Background Worker Status [Resolved]

    I have a background worker thread and I need it to periodically send up notices pertaining to what it's currently doing. I see it has a "progressChanged" event, but I need more than just a %.
    Is there anyway to Assign public properites to this thread?
    Or perhaps custom events?

    How do I get the worker thread to throw up more data than just the % completed?
    Last edited by JPicasso; Jul 18th, 2007 at 05:49 AM.
    Merry Christmas

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2.0] Background Worker Status

    The BackroundWorker is capable of changing class level read/write variables!!
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    Re: [2.0] Background Worker Status

    That was not my experience.

    The thread is spawned from a form. I wish to have the form display the current
    status and other information about what the worker thread is, well, working on.

    When we used threads in the past, we had to marshal events over to the "spawning"
    thread, before we could do any UI updates.

    I was looking to avoid managing an entire thread and just wanted my worker thread to
    post messages to the form. Looks like I may just have to bite the bullet and spawn a regular thread.

    I"m not at work now, but I'll take a look in the morning.
    Merry Christmas

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

    Re: [2.0] Background Worker Status

    When you call ReportProgress you can pass any object to the second argument. You get that object back from the e.UserState property in the ProgressChanged event handler. Because it can be any object you can use it for anything you like.
    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

  5. #5

    Thread Starter
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    Re: [2.0] Background Worker Status

    Holy moly. I was so close, yet, so far away.
    Somehow my brain shut down after seeing the "int Percentage" and ruled that method out.


    Thanks to both of you.
    Merry Christmas

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