Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7731093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:23:39+00:00 2026-06-01T06:23:39+00:00

Is this possible? What I want to do is have my doWork method instantiate

  • 0

Is this possible?

What I want to do is have my doWork method instantiate another class and then call its start method. Then i would like to report progress from that class back to the ProgressChanged handler in the parent class. I’ve tried passing a reference to the BackgroundWorker but i get an error.

private void ComplianceWorker_DoWork(object sender, DoWorkEventArgs e)
    {
        ComplianceControlCenter CCC = 
         new ComplianceControlCenter(taskList.CheckedItems.OfType<string>().ToList(),
                                     file_box.Text, &ComplianceWorker);
        CCC.start();
    }

EDIT:

There is only 1 background worker. I would like to pass it by reference to the constructor of ComplianceControlCenter so i can send progress updates to it from inside that class. The reasoning is the class do some fairly complicated work and i need to have a division. So again, i would like to pass the background worker from the doWork method to the CCC object so i can call ComplianceWorker.ReportProgress();

Error 1 Cannot take the address of, get the size of, or declare a pointer to a managed type (‘System.ComponentModel.BackgroundWorker’)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:23:41+00:00Added an answer on June 1, 2026 at 6:23 am

    You could do that, although I don’t see what purpose it would serve for simple cases. Since you are already inside the business method of a BackgroundWorker there’s no point in using yet more threads by creating another BackgroundWorker and you could do the same work inline.

    If you still want to have a second BackgroundWorker, you can propagate progress changed events from the second worker to the first by attaching a handler to the second worker’s ProgressChanged event. This handler would then raise the ProgressChanged event on the first worker, propagating the news.

    For example:

    private void ComplianceWorker_DoWork(object sender, DoWorkEventArgs e)
    {
        var CCC = new ComplianceControlCenter(/* ... */);
    
        // Assume that CCC exposes a BackgroundWorker, but read below
        var worker = CCC.Worker; // "second" worker
        worker.ProgressChanged += this.PropagateProgressChanged;
    
        CCC.start();
    }
    
    private void PropagateProgressChanged(object sender, ProgressChangedEventArgs e)
    {
        var worker = this.worker; // "first" worker
        worker.ReportProgress(e.ProgressPercentage, e.UserState);
    }
    

    This code attaches an event handler to the “second” worker with

    var worker = CCC.Worker; // "second" worker
    worker.ProgressChanged += this.PropagateProgressChanged;
    

    which assumes that ComplianceControlCenter exposes its own BackgroundWorker directly. Since that may not be the case, you can turn the relationship around by passing a reference to this.PropagateProgressChanged to the constructor instead and letting it attach the event handler for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a django model like this: class Model(models.Model): string = models.CharField()
I want to have an argument of type this class in an interface's method
Is this possible? I have a solution with both projects, I just want to
Is something like this possible: <form method=post action=myphp.php name=myname target=another_html/iframe_name>??? I want the php
Is something like this possible? Namespace Transaction, Document Class Signer Public Sub New() 'Do
I want to have the parent of my class handle the event first, then
Is this possible? I want to have the To:, Body, and an Attachment all
In my class I have a static method public static void DoWork(int param) ...
Not sure if this is possible: I want to use datatables to manipulate my
Is this possible to do? I want to ping or send some kind of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.