I am encounter a problem that I dont understand what is happening.

I use the Form application where I from Form4 will open Form22 like this wich works.

#pragma once
#include "stdafx.h"
#include "Form22.h"

Form22 ^form22 = gcnew Form22;

What I need to do now is to #include "Form4.h" in Form22 like this:

#pragma once
#include "stdafx.h"
#include "Form4.h"

I also tried this in Form22:

#pragma once
#include "stdafx.h"

#ifndef FORM4_H
#define FORM4_H 
#include "Form4.h"

But if I try to #include "Form4.h" in Form22, I will have a compileError that says this. So I dont know why this is happening and what I can do about it.

'Form22' : undeclared identifier
'form22' : undeclared identifier

8 Years
Discussion Span
Last Post by Jennifer84

My actual case is that I need to know how it is possible to pass a "string" from Form22 to Form4.

The test I could think of could be:

Lets say that Form22 has a textBox1 that has the string "Hello".
Then when pressing the button "OK" that will close the Form22,
then Form4 will show a MessageBox with "Hello".

Within a Form I know how to do this but many get stuck when doing
this through forms.
So I wonder how I will begin this ?

Thank you

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.