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 8188355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:52:57+00:00 2026-06-07T02:52:57+00:00

Right, this is my first venture into multi threading so could be something incredibly

  • 0

Right, this is my first venture into multi threading so could be something incredibly simple I’m missing but here goes…

I’m using thread pool to kick off a bunch of short running processes at the same time, each will be passed a URL to process/scrape for fb-tweets-google-plusones and return a result to my ReportProgress method by invoking the delegate ThreadDone but when passing in the processed object once the thread’s done processing, i keep getting the error Method name expected but I’m passing in the method ReportProgress? I’m willing to bet (hoping) it’s something incredibly simple that someone more experienced can spot right away. Here is what i have so far:

Delegate definition:

public delegate void ThreadDone(object sender, ScrapeResult scrapedResult);

DoWork:

public void DoWork(object sender)
{
      while (true)
      {
          //lock the thread to prevent other threads from processing same job
          lock (_threadLock)
          {   
              string url = (string)sender;
              result.URL = url;

              if (chkFb.Checked)
              {
                  result.Shares = grabber.GetFacebookShares(url);
              }
              if (chkTwitt.Checked)
              {
                  result.Tweets = grabber.GetTweetCount(url);
              }
              if (chkPlusOne.Checked)
              {
                  result.PlusOnes = grabber.GetPlusOnes(url);
              }

              this.Invoke(new ThreadDone(ReportProgress(sender, result))); //ERROR is on this line
           }
           Thread.Sleep(100);
        }
}

ReportProgress:

private void ReportProgress(object sender, ScrapeResult scrapedResult)//<-- might not need?
{
     progressBar.Value++;
     ScrapeResult result = (ScrapeResult)sender;//ScrapedResult result = scrapedResult;
     outputGrid.Rows.Add(result.URL, result.Shares, result.Tweets, result.PlusOnes);
     outputGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     outputGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
}

Any help is greatly appreciated!

  • 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-07T02:52:59+00:00Added an answer on June 7, 2026 at 2:52 am

    Change this:

    this.Invoke(new ThreadDone(ReportProgress(sender, result)));
    

    To:

    this.Invoke(new ThreadDone(ReportProgress), sender, result);
    

    The first parameter of Invoke() is the delegate, to build a delegate you do not need to give its parameters but only the method to call (that’s why compiler says “method name expected”) With new ThreadDone(ReportProgress) you create the new delegate and with 2nd and 3rd parameter of Invoke() you specify the parameters that will be passed to your delegate.

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

Sidebar

Related Questions

My first post here, so i hope this is the right area. I am
In order to add events we could use this simple first solution : function
this is my first question here so I hope I'm doing this right. I
Having some issues with Mod_Rewrite. I must admit this is my first venture into
Right so some really noob(this is my first deployment of a bundle to Karaf)
Right, so this is my first day using XML. I'm not creating the XML,
First of all I don't know if this is the right approach. I want
I'm learning this right now so the questions might be a little juvenile. Here's
Right now i have this ***FIRST***1DESIGNRESULTSM25Fe415 ***Second***Fe415 ***Third***1500.0mm ***Fourth***300.0mmX600.0mmCOVER:40.0mm ***Fifth***15ENDJOINT:13SHORTCOLUMN ***Sixth***5472.00Sq.mm.REQD.CONCRETEAREA:174528.00Sq.mm ***Seventh***12-25dia.(3.27%,5890.49Sq.mm.)(Equallydistributed) ***Eighth***8mm ***Ninth***300mmc/c
Am I doing this right? var jForm= $(form:first); jForm.submit(function( objEvent ) { setTimeout(somefunction(),500) });

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.