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

Window Timer in a new Thread

Hi ,
I want to create a System.Windows.Forms.Timer in a new Thread.
When I do this everything remains OK but the timer never goes inside
its tick event.I'm in deadlock condition. If anyone can give me some hint,
I shall be very thankful to him/her.

Regards-
Saurabh

saurabh singh
Newbie Poster
9 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

hi,

I am not sure whether i understood you fully. but a timer runs in a thread.
Why do you want to have a timer in a new thread?

could you please elaborate your requirement so that we can help you?

Regards


Exelio

Exelio
Junior Poster in Training
57 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
 

Thanks for reply,

[there is a form that has to be moved on the screen]-->[it is complete,with timer]
-->[timer moves it on the screen]-->[now its instance is to be created in some another form application, in a new thread (due to some reason)]-->[Now when this instance is called in the new form then it's timer's tick event doesn't work]

this is the scenario.

hi,

I am not sure whether i understood you fully. but a timer runs in a thread. Why do you want to have a timer in a new thread?

could you please elaborate your requirement so that we can help you?

Regards

Exelio

saurabh singh
Newbie Poster
9 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

Hi , I want to create a System.Windows.Forms.Timer in a new Thread. When I do this everything remains OK but the timer never goes inside its tick event.I'm in deadlock condition. If anyone can give me some hint, I shall be very thankful to him/her.

Regards- Saurabh


It's probably too late but just for the sake of others who will come here from Google. It doesn't work because it adds events to a different queue than main application one and so events doesn't get dispatched. I guess (but never tried this myself) calling Application.DoEvents() in the thread where timer was started should cure the situation. Of course you would have to call it all the time, just one time wouldn't do it.

vavatl
Newbie Poster
1 post since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You