Hi,

I created a few window forms and I faced problem when try to link them up. I am able to link up two window form but the problem comes when I tried to link up more than 1 window forms.

For example when I want to link up the first window form with the second form :

form2()->ShowDialog();

However, when I tried to link back from second window form to first window form using the same code:

form1()->ShowDialog();

I got the error of : form1() identifier not found.

I already included respective header file but the code still not working. Why is it so? I attached a simple example on the problem I faced. Hope someone can lend me a helping hand....Really need this in urgent.

Million thanks in advance.

Adrian

Why not just close the second form?

[edit]
I've actually read your code and the errors in it have nothing to do with the question you asked here.

- in form2.h add the line #include "form3.h" - in interface.cpp change #inclide "form2.h" to #include "form2.h" Code works fine after these changes

Hi,

What if we add a button on form3 and try to link it back to form2? I added the following code when the button on form3 is clicked:

form2().ShowDialog();

Besides, I also add the line #include "form2.h" in form3.h .Then i got back the same problem, form2 not identify, really confuse by this....Why is it so??

Whenever we wan to link one form to another form, we juz include the header file of form we wan to link?

Regards,
Adrian

I still struggling with the problem.....help....

>link back to form2

So form3 is open and you want back to form2?

questions:
-is form2 open in the background?
-does form3 needs to stay open?

And another thing:
Put your code that handles the button, in the CPP files, not in de header (h) files.

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.