I see no f2
in your example. Usually I do something like this:
Create an interface that describes what f1
does:
interface if1
{
string Name {get;}
}
Implement this in f1
:
public class f1 : Form, if1
{
public string Name { get { return name; } }
}
Pass f1
to f2
:
f1 emp = new f1();
f2 x = new f2(f1);
Constructor of f2
:
public f2(if1 f1)
{
string nameOfForm1 = f1.Name;
}