我有一个HeaderFile Common_Datas.h
//Common_Datas.h
public ref class MyDBDatas
{
//blah...blah...blah...
public: static System::Void Material_Name( System::Object^ Sender, System::Windows::Forms::KeyEventArgs^ e) {
//blah...blah...blah...
}
public: static System::Void Supplier_Name( System::Object^ Sender, System::Windows::Forms::KeyEventArgs^ e) {
//blah...blah...blah...
}
};
现在从我的Form2 - textBox2我想声明
textBox2->KeyDown += gcnew KeyEventHandler(MyDBDatas, &MyDBDatas::Supplier_Name);
另外,我想学习同样的陈述,如何在“代表”政治家中使用?
...谢谢
答案 0 :(得分:1)
委托构造函数中的第一个参数是应该调用委托的对象,而不是类型。在MyDBDatas构造函数中尝试这个:
MyDBDatas()
{
textBox2->KeyDown += gcnew KeyEventHandler(this, &MyDBDatas::Supplier_Name);
} ^^^^