You should have an underlying data structure with methods to change the data. Usually that is called the business logic layer.
It should also declare and fire the appropriate events to inform your UI of any changes.
[Edit]
It's done something like that:
public static class UnderlyingData
{
private static string _someText = "Initial Value";
public static string SomeText
{
get { return (_someText); }
set { _someText = value; }
}
public static delegate void StringDelegate( string stringTypedParameter);
public static event StringDelegate SomeTextChanged;
public static string SomeText
{
get { return (_someText); }
set
{
_someText = value;
StringDelegate eventHandler = SomeTextChanged;
if( eventHandler != null)
{
eventHandler(_someText);
}
}
}
}
public class Form1 : Form
{
private void TextBox1.TextChanged(object sender, EventArgs e)
{
UnderlyingData.SomeText = TextBox1.Text;
}
}
public class Form2 : Form
{
private void Form2_Load(object sender, EventArgs e)
{
UnderlyingData.SomeTextChanged += new UnderlyingData.StringDelegate(UnderlyingData_SomeTextChanged);
}
private void UnderlyingData_SomeTextChanged(string someText)
{
Label42.Text = someText;
}
}
That's the minimal example. Of course, you can use the event in Form1 as well, if there is some other thing that depends on the changed data. Or you can incorporate validation checks in the property's set accessor.
[/Edit]