本文介绍了参数计数不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<pre lang="cs">public delegate void buttonclick(object sender, EventArgs e);
        private void button1_Click(object sender, EventArgs e)
        {

            if (button1.InvokeRequired)
                button1.Invoke(new buttonclick(button1_Click));

            if (button1.BackColor == Color.LightGreen)
            {
                move_button(condition.Text.Split(new char[] { &#39; &#39; })[0].ToString(), hold_button, button1);
            }
            else
            {
                Place_Point(button1);
            }
        }</pre>

private void sampleclick()
{
 button1_Click(this,new EventArgs());
}





当我从sampleclick调用button_click方法时,它显示异常参数计数不匹配它的含义是什么我怎样才能克服这个异常....



When i call button_click method from sampleclick it shows an exception "Parameter Count Mismatch" what is the meaning of it and how can i overcome this exception....

推荐答案

if (button1.InvokeRequired)
      button1.Invoke(new buttonclick(button1_Click) ??????? );





像这样改写:





Rewrite it like this:

if (button1.InvokeRequired)
      button1.Invoke(new buttonclick(button1_Click), sender, e);



这篇关于参数计数不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-22 00:00