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

  • Home
  • SEARCH
  • 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 7188725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:08:49+00:00 2026-05-28T19:08:49+00:00

I am trying to follow this example from MSDN: http://msdn.microsoft.com/en-us/library/a1hetckb.aspx I think i’m doing

  • 0

I am trying to follow this example from MSDN: http://msdn.microsoft.com/en-us/library/a1hetckb.aspx

I think i’m doing everything they did but i keep getting this error: Parameter count mismatch

Here is my code:

Form1:

 namespace ETL
 {
   public partial class Form1 : Form
   {
       private Thread myThread;
       public delegate void delegatePrintoutProcess(string myString);
       public delegatePrintoutProcess myDelegate2;
  ...

    private void startParseToolStripMenuItem_Click(object sender, EventArgs e)
    {
        myDelegate2 = new delegatePrintoutProcess(updatePrintoutMethod);
        myThread = new Thread(new ThreadStart(ThreadFunction));
        myThread.Start();  
    }
    public void updatePrintoutMethod(string text)
    {

       // this.richTextBox1.Text = text;
    }
    private void ThreadFunction()
    {
        parseFile myThreadClassObject = new parseFile(this);
        myThreadClassObject.getFilePath = filePath;
        myThreadClassObject.Run();


    }
}

parseFile class:

 namespace ETL
 {
    public class parseFile
    {
        Form1 myFormControl1;
    public parseFile(Form1 myForm)
    {
        //get a handle on the main form
        myFormControl1 = myForm;
    }
    String myString;
    public void Run()
    {

        for (int i = 1; i <= 5; i++)
        {
            myString = "Step number " + i.ToString() + " executed";
            Thread.Sleep(400);
            // Execute the specified delegate on the thread that owns
            // 'myFormControl1' control's underlying window handle with
            // the specified list of arguments.
            myFormControl1.Invoke(myFormControl1.myDelegate,
                                   new Object[] { myString }); //error here
        }
    }
  }

I’m pretty sure i’ve followed the provided example, so not sure what is going on.

Thanks
jason

  • 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-05-28T19:08:51+00:00Added an answer on May 28, 2026 at 7:08 pm

    Guess (as no code to prove) – type of myDelegate is “function with 0 or 2 arguments”, unlike myDelegate2 that you probably wanted to call.

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

Sidebar

Related Questions

I'm trying to implement a simple TPH example from http://msdn.microsoft.com/en-us/library/dd793152.aspx . I have two
I been trying to follow the example on this page: http://grysz.com/2010/06/01/use-custom-fonts-in-jasperreports-pdf-exporter/ Still, when I
I am trying to follow this example (from p137 of Rob Pickering's Foundations of
I want to include Core Location and I'm trying to follow this tutorial: http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
I have been trying to follow this example (download the source code from a
I have been trying to follow this example from propel to configure a custom
I am trying to follow what is being explained here: http://www.djangobook.com/en/2.0/chapter03/ (the confusing example
Trying to follow this example. (Section String sorting...) Is there anything obvious that would
This is a follow-on from this question, in which I was trying to suppress
This is a follow-up to Dynamic Shared Library compilation with g++ . I'm trying

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.