i have a funcion 'button1_click' in the header 'MyForm1.h'. I want to use this function in another header 'MyForm.h'. How can i do this? i already included 'MyForm1.h' in 'MyForm.h'.
CodePudding user response:
If you have added the reference into the form file then you should be able to call it from MyForm.h:
#include "MyForm1.h"
namespace MyForms {
... Initialize component and winform code ...
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
MyForm1^ form1 = gcnew MyForm1;
form1->ShowDialog();
lblData->Text = form1->MyFunctionFromForm1();
}
}
CodePudding user response:
Try using namespace, example below:
void MyForm::sample();