954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

EventHandler & Return Types

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 ;
        }
superjj
Light Poster
32 posts since Nov 2010
Reputation Points: 10
Solved Threads: 1
 

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

gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
 

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

superjj
Light Poster
32 posts since Nov 2010
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: