public partial class A : UserControl
{
private string _x;
public string X {
get { return _x; }
set {
this._x = value;
this.textBox1.Text = this._x;
}
}
public partial class B : WinForm
{
public B() {
//Add usercontrol A to Groupbox1
//Set A.X = "hello world"
}
}
public class MainForm: WinForm
{
public void button1_Click(....) {
B bForm = new B();
bForm.ShowDialog();
}
}
At design time, I set the textbox1.Text="hello". In the Main Class, I have a button that will open a new form B and on that form B I have a group box to add this user control A and change the X property value = "hello world" but the textBox1.Text doesn't change on the UI. When I set break point after the set textbox1.Text = this._x, it shows the value did change to "hello world" but it's not reflected on the UI?
Why? And how to fix it?
Thanks a bunch.