1.11M Members

EventHandler & Return Types

 
0
 

hi

I get an error, "has the wrong return type".
it has something to do with "tim1.Tick += new System.EventHandler(tim1_tick);"

Help me please.

Timer tim1 = new Timer();
        DateTime huidigetijd = new DateTime();
        private bool CheckTim1Start;
        public Wekker()
        {
            tim1.Tick += new System.EventHandler(tim1_tick);
           // tim1.Enabled = true;  enable == start
            tim1.Start();
            tim1.Interval = 3000;
        }

        

        public bool HuidigTijdzien
        {
       
            set { CheckTim1Start = value;
                    if (CheckTim1Start)
                        {
                         tim1.Start();
                        }
                    else
                        {
                         tim1.Stop();
                     }
                }
        }
        public DateTime tim1_tick(object sender, EventArgs e)
        {
          
            return  huidigetijd = DateTime.Now ;
        }
 
0
 

I think it has to do with line 28 where your returning a DateTime..Try returning void.

 
0
 

If I returne void, than It work. But I want to return the date

Question Answered as of 2 Years Ago by gerard4143
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: