I have set the timer1.enabled = true
and timer1.interval = 10000 --> represents 10 seconds
It seems the timer tick event does not get fired in windows service.
I have tried placing other timers and they seem to have the same issue.
When I use the timers on a form, they seem to work fine.
Is there anything I should do inside the windows service so that the tick event of the timer is fired?
I am using a timer inside a Windows Service with no problem. I do use the Timer Start() and Stop() methods, but I would expect that enabling and disabling would work just fine. Have you checked the event viewer to ensure there are no errors being generated by the service that might explain this problem?
When you abort the thread, you kill the message pump that handles the messages that does everything in the GUI. There is nothing that can handle the message that says that the window should be removed.
Generally, using the Abort method is a bad way to stop a thread. The Abort method kills the thread by throwing a ThreadAbortException in it, which can happen anywhere in the thread's code. It's difficult to write code that can cope with that situation in a well behaved manner.
Despite everything, the person most likely to be fooling you next is yourself.
It works fine if i'm doing no loading after the thread start command, but if I add the PopulateTree call (or just a Thread.Sleep()), it gives me a InvalidOperationException (Invoke or BeginInvoke cannot be called on a control until the window handle has been created).