all groups > dotnet clr > may 2007 >
You're in the

dotnet clr

group:

thread differences from button_Click and tmr_Elapsed


thread differences from button_Click and tmr_Elapsed Victor Reboucas
5/22/2007 8:44:01 PM
dotnet clr: Hi, I'm experiencing some kind of thread behavior problem in a WinForms app
in Vb.Net 2.0.

Actually I'm doing some huge interop using DirectShow to interact with my
miniDV camera.

The problem is that if I put the code to read the camera's timecode inside a
button_click routine it works just fine, but, if I put that code to run on a
timer_elapsed event I get error (in particular, NotImplementedException from
the interop layer).

The question is: what is different in calling a method in a button click
routine and in a timer elapsed event (in threads meaning), is that the "user
interaction" (button click) that creates a new thread automatically or sth
like that?


Thanks for any clue,
Victor

Re: thread differences from button_Click and tmr_Elapsed Victor Reboucas
5/22/2007 9:56:48 PM
Found that... just change the timer from system.timers.timer to forms.timer
to run all operations on the same thread.



[quoted text, click to view]

AddThis Social Bookmark Button