Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataBindings ignore programmatic property changes
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00922911
Message ID:
00922918
Views:
14
This message has been marked as the solution to the initial question of the thread.
Hi Steve,

You need to add an event to notify the data binding system that your property has changed. Modify the Person class to look like this.
public class Person
{
    public event EventHandler NameChanged;
    private string _name;

    public Person(string name)
    {
        Name = name;
    }

    public Person()
    {
        Name = "";
    }
	
    public string Name
    {
        get { return _name; }
        set 
        { 
            _name = value; 
            if (NameChanged != null)
            {
                NameChanged(this, new EventArgs()); 
            }
        }
    }
}
For more details check out Windows Forms Data Binding and Objects by Rocky Lhotka.
---
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://www.msmvps.com/windsor
http://www.g6consulting.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform