Hey,
i have a CLR proyect where i have 2 forms, i am trying to acces the form1 class via form2.

what i did is that i included the header.h of the form in form.h but it failed so i went back and icluded thesame folder both of them are there and then it compiled fine.
then i tried to acces form1.h but it doesnt locate anything in the header so then i made a function in form1.h and not even that it wont located it wont locate.

Recommended Answers

All 3 Replies

Please post your code. Don't forget to push the code button before you paste each file.

Modify the constructor of form2 to take a form1 object. Assign that to a private form object in your form2. Operate on it like you would any other object.

Caveat: I've been trying to get a sample together and have been having some problems with circular references. It's fairly trivial in C# since there are no headers.

Take a look at http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/097d7025-7c67-444d-909a-a91d05eb298d/ which is one of the clearest explanations I've seen as to how to do this. Also note they give some alternatives too!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.