I have a winforms application and what i want to achieve is making the Userinterface auto updates it self once the objects it is binded to is changed.
This is the what i have tried but unfortunately the text box text isn't changed automatically!
Employee employee = new Employee();
public Form1()
{
InitializeComponent();
textBox1.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged;
textBox1.DataBindings.Add("Text", employee, "Name");
}
class Employee
{
public string Name { get; set; }
public int Age { get; set; }
}
private void button1_Click(object sender, EventArgs e)
{
employee.Name = Guid.NewGuid().ToString();
}