I am working on my application using with native c++. I am trying to create a code as public testmycode() function to linking up with the code that I have input them for each line in the form2_load event, so in that way it would make it shorter and it will be much easy for me to read the code in each line, but I can't be able to get rid of the error I am getting. No one would know how to help me and most of them don't know what I am trying to do, so I hope one of you will know what to do and how to help me out. I have stored the code in the form2.cpp.
The error I am getting is: error C2440: 'initializing' : cannot convert from 'System::Windows::Forms::Form ^' to 'MyApplication::Form1 ^'
What you're trying to do there is implicitly cast a base class to a derived class. I don't think that's what you want to do in this case.
If I might make a suggestion, you might want to pass a Form1 handle and a Form2 handle into the method. That way you'll have control over what's in the forms when you run your test.