Click to See Complete Forum and Search --> : Delegate (assocoation function)


morel
July 14th, 2007, 03:03 PM
hi,
i would use delegate with associate a function



private: System::Void buttonStart_Click(System::Object^ sender, System::EventArgs^ e) {
arr+= gcnew PacketArrivalEventHandler(&BHIDS00::Form1::LibWinPcap_PacketArrival);

}



public :delegate void deleg(Packet^ e);
event deleg ^arr;



arr += gcnew deleg(this, DisplayListbox(e.Packet));

arr(e.Packet);
}

void DisplayListbox(Packet^ value)
{.................. }



there are 2 errors :

Error 1 error C3364: 'BHIDS00::Form1::deleg' : invalid argument for delegate constructor; delegate target needs to be a pointer to a member function c:\documents and settings\bureau\bhids0.4\bhids0.0\Form1.h 788

Error 2 error C3352: 'void BHIDS00::Form1::LibWinPcap_PacketArrival(WinPcapWrapper::PacketArrivalEventArgs)' : the specified function does not match the delegate type 'void (WinPcapWrapper::PacketArrivalEventArgs ^)' c:\documents and settings\bureau\bhids0.4\bhids0.0\Form1.h 1002


thank you verry mutch