Click here to Skip to main content
15,917,481 members
Home / Discussions / C#
   

C#

 
AnswerRe: sharepoint...???? Pin
Dave Kreskowiak2-Feb-05 2:03
mveDave Kreskowiak2-Feb-05 2:03 
Generalstarting stopping services Pin
Mridang Agarwalla1-Feb-05 20:00
Mridang Agarwalla1-Feb-05 20:00 
GeneralRe: starting stopping services Pin
spif20011-Feb-05 20:54
spif20011-Feb-05 20:54 
GeneralRe: starting stopping services Pin
Member 16488292-Feb-05 0:21
Member 16488292-Feb-05 0:21 
GeneralRe: starting stopping services Pin
Dave Kreskowiak2-Feb-05 2:00
mveDave Kreskowiak2-Feb-05 2:00 
GeneralSystem.Timers.Time class Pin
vyki_c1-Feb-05 18:27
vyki_c1-Feb-05 18:27 
GeneralRe: System.Timers.Time class Pin
Gavin Jeffrey1-Feb-05 21:36
Gavin Jeffrey1-Feb-05 21:36 
GeneralRe: System.Timers.Time class Pin
Stefan Troschuetz1-Feb-05 21:48
Stefan Troschuetz1-Feb-05 21:48 
The System.Timers.Timer is designed for use with worker threads in a multi-threaded environment and can move among threads to handle the raised events.
So your handler for the Elapsed event isn't executed in the context of the same thread that created the timer and most likely also created the window you want to show. But accessing windows controls from threads other than the one which instanciated them has often weird results e.g. they're hanging.
So either use the System.Windows.Forms.Timer, which is designed for a single-threaded environment where UI threads are used to perform processing, or invoke the Show method of your window, so it gets executed on the thread that instantiated the control. For more information on the latter possibility, take a look at the docs for the Control.Invoke[^] method.

By the way, it's sufficient to subscribe the event handler once and calling Start after setting Enabled true is redundant, as it does exactly the same.







www.troschuetz.de
GeneralRe: System.Timers.Time class Pin
vyki_c2-Feb-05 5:18
vyki_c2-Feb-05 5:18 
GeneralRe: System.Timers.Time class Pin
Stefan Troschuetz2-Feb-05 21:44
Stefan Troschuetz2-Feb-05 21:44 
General.Net Rollback question Pin
ting6681-Feb-05 18:00
ting6681-Feb-05 18:00 
GeneralRe: .Net Rollback question Pin
spif20011-Feb-05 20:47
spif20011-Feb-05 20:47 
GeneralSqlParameter Question Pin
Tee+1-Feb-05 17:51
Tee+1-Feb-05 17:51 
GeneralRe: SqlParameter Question Pin
Colin Angus Mackay1-Feb-05 21:00
Colin Angus Mackay1-Feb-05 21:00 
GeneralScroll + DrawImage Help Pin
jk chan1-Feb-05 16:38
jk chan1-Feb-05 16:38 
GeneralRe: Scroll + DrawImage Help Pin
Christian Graus1-Feb-05 17:02
protectorChristian Graus1-Feb-05 17:02 
GeneralRe: Scroll + DrawImage Help Pin
jk chan1-Feb-05 17:51
jk chan1-Feb-05 17:51 
GeneralRe: Scroll + DrawImage Help Pin
Christian Graus2-Feb-05 9:05
protectorChristian Graus2-Feb-05 9:05 
GeneralRe: Scroll + DrawImage Help Pin
Robert Rohde1-Feb-05 20:32
Robert Rohde1-Feb-05 20:32 
GeneralDelimiters While Reading Text Files Pin
Anonymous1-Feb-05 13:35
Anonymous1-Feb-05 13:35 
GeneralRe: Delimiters While Reading Text Files Pin
Robert Rohde1-Feb-05 20:35
Robert Rohde1-Feb-05 20:35 
GeneralRe: Delimiters While Reading Text Files Pin
spif20011-Feb-05 20:42
spif20011-Feb-05 20:42 
GeneralRe: Delimiters While Reading Text Files Pin
Anonymous2-Feb-05 4:21
Anonymous2-Feb-05 4:21 
GeneralRe: Delimiters While Reading Text Files Pin
Dave Kreskowiak2-Feb-05 4:35
mveDave Kreskowiak2-Feb-05 4:35 
GeneralRe: Delimiters While Reading Text Files Pin
Sean Michael Murphy2-Feb-05 6:48
Sean Michael Murphy2-Feb-05 6:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.