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?

Your code looks like C++/CLI.
C++/CLI is not the same as C++, and this is a C++ forum.

We both know that you're more likely to get help on StackOverflow than here:

http://stackoverflow.com/questions/24989569/sending-form-as-parameter-in-c
closed account (z05DSL3A)
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.