Form1 code:
Form2 my2ndForm = new Form2()
my2ndForm.Property1 = "some value";
my2ndForm.Property2 = "some other value";
DialogResult result = my2ndForm.ShowDialog();
// result now contains a return code from the dialog
Form2 code:
string _property1 = "";
public string Property1
{
set
{
_property1 = value;
}
get
{
return _property1;
}
}
//
// complete as property 2 as with property1
// you can now reference _property1 and _property2
// in your form code, for form initialization place
// in the load event handler for the form
hope that helps
Dan.
Macca wrote:
Hi,
I am desiging a windows form application that that will have a hierarchy of
forms.
Can anyone tell me the best way of passing data between these forms?
Is it possible to use global variables or some sort of messaging like in
Visual C++?
Thanks In Advance
Macca