Hi People,

Im trying to create a PersonChanged EventHandler..

i have this:

public class Pessoa
    {

        private int _idade;
        private bool _isDeleted;

        public Pessoa()
        {
            // TODO: Complete member initialization
        }

        //Propriedades da Classe Pessoa (Nome, Profissão e Idade)
        public string id { get; set; }
        public string nome { get; set; }
        public int idade { get { return _idade; } set { _idade = value; } }
        public string profissao { get; set; }
        public string signo { get; set; }
        public string morada { get; set; }
        public string telemovel { get; set; }
        public string email { get; set; }
        public bool IsDeleted
        {

            get { return _isDeleted; }
            set { if (_isDeleted != value) { _isDeleted = value; PessoaChanged(); } } }

        public event EventHandler PessoaChanged;

        }
    }

and hi have a error: Delegate EventHandler does not take 0 arguments..
Can you help?
Thanks.

Changes:

public event EventHandler PessoaChanged;

        protected virtual void OnPessoaChanged(EventArgs e)
        {
            EventHandler PessoaChangedHandler = PessoaChanged;
            if (PessoaChangedHandler != null)
            {
                PessoaChangedHandler(this, e);
            }
        }

Now i want to show a "*" on title form to user knows the app have changes.

Edited 1 Year Ago by mdev: forgor a thing

This article has been dead for over six months. Start a new discussion instead.