Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Error in c# code??

  • 26-11-2008 2:41pm
    #1
    Registered Users, Registered Users 2 Posts: 6,535 ✭✭✭


    Im getting an error and not sure why. Im using c# and wpf

    the error im getting is

    'Practice_BindingtoObject.Player' does not implement interface member
    'System.ComponentModel.INotifyPropertyChanged'

    heres my code....

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ComponentModel;

    namespace Practice_BindingtoObject
    {
    class Player:INotifyPropertyChanged
    {
    public event PropertyChangedEventHandler propertyChanged;
    private string _name;
    private DateTime _dob;
    private string _imageFile;



    public string Name
    {
    get { return _name; }
    set
    {
    if (value != _name)
    {
    _name = value;
    NotifyPropertyChanged("Name");// notifys that the value for the image file has changed
    }
    }

    }

    public string DOB
    {
    get { return _dob; }
    set
    {
    if (value != _dob)
    {
    _dob = value;
    NotifyPropertyChanged("DOB");
    }
    }

    }

    public string Image
    {
    get { return _imageFile; }
    set
    {
    if (value != _imageFile)
    {
    _imageFile = value;
    NotifyPropertyChanged("Image");
    }
    }

    }
    private void NotifyPropertyChanged(String info)
    {
    if (PropertyChanged != null)
    PropertyChanged(this, new PropertyChangedEventArgs(info));
    }

    public Player()//default constructor
    {
    Name = "robbie folwer";
    DOB = "1/01/85";
    Image = "";
    }

    public Player(string name, DateTime dob, string image)//working constructor
    {
    Name = name;
    DOB = dob;
    Image = image;

    }


    }//end class
    }//end namespace


    Any help would be great thanks :confused:


Comments

  • Registered Users, Registered Users 2 Posts: 2,013 ✭✭✭lynchie


    Use
    tags in future to keep the code formatted, easier to read..
    
    Case Sensitivity is your answer.
    
    
    [code]
            public event PropertyChangedEventHandler propertyChanged;
    

    is not the same as
            public event PropertyChangedEventHandler [b]P[/b]ropertyChanged;
    


  • Registered Users, Registered Users 2 Posts: 6,535 ✭✭✭joe123


    Bloody Case sensitivity:rolleyes:

    Thanks thats it sorted.


Advertisement