We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,442 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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 ;
        }
2
Contributors
2
Replies
59 Minutes
Discussion Span
1 Year Ago
Last Updated
3
Views
Question
Answered
superjj
Light Poster
43 posts since Nov 2010
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0

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

gerard4143
Nearly a Posting Maven
2,295 posts since Jan 2008
Reputation Points: 512
Solved Threads: 397
Skill Endorsements: 0

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

superjj
Light Poster
43 posts since Nov 2010
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0
Question Answered as of 1 Year Ago by gerard4143

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0683 seconds using 2.91MB