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 ;
        }

Recommended Answers

All 2 Replies

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.