参数计数不匹配 [英] Parameter Count Mismatch

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

问题描述

<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....

推荐答案

buttonclick方法有两个你在通话中没有提供的参数。



The buttonclick method takes two parameters wich you're not supplying in your call.

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





像这样改写:





Rewrite it like this:

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


你必须检查函数中你在代码中调用的参数的数量。

我认为你的move_button引起的问题o r Place_Point函数。
You have to check the count of the parameters in your functions what you call in your code.
I think the problem caused by your move_button or Place_Point functions.


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆