Sending form as parameter in c++
1 2 3 4 5 6 7 8 9 10 11 12 13
|
int main()
{
Form1^ myform1 = gcnew Form1();
myform1->comboBox1->Items->Insert(0,"String1");
myfunction();
Application::Run(myform1);
}
int myfunction()
{
myform1->comboBox1->Items->Insert(1,"String2");
return 0;
}
|
How to send a win32 form as parameter to another userdefined function?
How to send a win32 form as parameter to another userdefined function? |
Forms are not Win32, they are CLI (.net on windows), hence why you use
C++/CLI (a lanuage in it own right) instead of C++
But any how it goes some thing like this:
1 2 3 4
|
int myfunction(Form^ form)
{
//...
}
|
calling it:
myfunction(myform1);
But don't get too used to it because Microsoft don't want you to be using C++/CLI for Forms, it wasn't designed for that.
Topic archived. No new replies allowed.