如何在此void中传递其他参数?
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
我尝试添加此参数:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e, MySqlDataAdapter ^data, DataSet ^dataset)
但是编译器给了我:
错误1错误C3352:'void loadprocedura :: Form1 :: button1_Click(System :: Object ^,System :: EventArgs ^,MySql :: Data :: MySqlClient :: MySqlDataAdapter ^,System :: Data :: DataSet ^ )':指定的函数与委托类型'void(System :: Object ^,System :: EventArgs ^)'
不匹配然后我尝试在这里添加参数,但不起作用
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
我是visual c ++的初学者;)
答案 0 :(得分:0)
button1->Click accepts
某种代表:
void (System::Object ^,System::EventArgs ^)
如果您想手动触发事件,只需向System::EventArgs
对象添加参数即可。
您应该阅读有关C#事件的教程: