LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Fire Event from other event in Visual C++ Express Edition (https://www.linuxquestions.org/questions/programming-9/fire-event-from-other-event-in-visual-c-express-edition-597942/)

chrisliando 11-07-2007 10:59 PM

Fire Event from other event in Visual C++ Express Edition
 
Hi I was trying to fire an event from another event (I just want if I click the button it also raise the FormClosing event) in my codes below:



private: System::Void FormInputPersonal_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) {
e->CloseReason;
}



private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
//close Form.
this->button2->Click += gcnew System::EventHandler(this, &FormInputPersonal->FormClosingEventHandler);
}



but I had trouble on the event Button2 Click which generated errors:



------ Build started: Project: Assignment1, Configuration: Debug Win32 ------
Compiling...
FormInputPersonal.cpp
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(449) : error C2819: type 'Assignment1::FormInputPersonal' does not have an overloaded member 'operator ->'
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(24) : see declaration of 'Assignment1::FormInputPersonal'
did you intend to use '.' instead?
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(449) : error C2039: 'FormClosingEventHandler' : is not a member of 'Assignment1::FormInputPersonal'
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(24) : see declaration of 'Assignment1::FormInputPersonal'
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(449) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
Assignment1.cpp
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(449) : error C2819: type 'Assignment1::FormInputPersonal' does not have an overloaded member 'operator ->'
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(24) : see declaration of 'Assignment1::FormInputPersonal'
did you intend to use '.' instead?
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(449) : error C2039: 'FormClosingEventHandler' : is not a member of 'Assignment1::FormInputPersonal'
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(24) : see declaration of 'Assignment1::FormInputPersonal'
c:\chris\testing\assignment1\assignment1\FormInputPersonal.h(449) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
Generating Code...
Build log was saved at "file://c:\Chris\Testing\Assignment1\Assignment1\Debug\BuildLog.htm"
Assignment1 - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Please help me with this problem.



Thank you very much..

matthewg42 11-08-2007 05:12 PM

I realise this sub-forum is about programming in general, but this site is Linux Forums, not Windows Forums.

I'm sure that if anyone here knows about Microsoft's development platform, they will be happy to discuss it (as would I if I knew enough about it). However you're much more likely to find Linux and Unix coders here, and not so many coders who use Visual C++.

I say this not to discourage discussion of MS products, but because I don't want you to feel like your questions are being ignored... it's just that you're asking people who for the most part don't use the product you are asking about.

One more thing - please post code, compiler output and data examples enclosed in [code] tags. This will cause that part of your post to be printed in a fixed width font, and will preserve formatting, aiding readability.


All times are GMT -5. The time now is 02:55 PM.