Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataBindings ignore programmatic property changes
Message
De
10/07/2004 09:45:55
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00922911
Message ID:
00922964
Vues:
13
Oh man, Rob ... I *knew* I was overlooking *something*!! I should have known this. Thanks for pointing it out!

~~Bonnie



>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.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform