Joined
·
2,005 Posts
Hey Guys,
How do I access variables in Form 1 so I can use them on Form 2.
Thanks Guys,
Chris
How do I access variables in Form 1 so I can use them on Form 2.
Thanks Guys,
Chris
void Form1::Foo()
{
// Pass just the data to Form2
Form2 form2 = new Form2(A(), B(), C());
// ...
}
void Form1::Foo()
{
// Reduce coupling between the two objects by just passing a small/specific
// interface to Form2 i.e. don't pass the entire Form.
Form2 form2 = new Form2((ISmallSpecificInterface)this);
// ...
}
public interface ISmallSpecificInterface
{
string A { get; set; }
}