Click here to Skip to main content
15,909,656 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem with Timer object Pin
Martin#11-Jul-07 21:32
Martin#11-Jul-07 21:32 
Hello,

As you are using the Forms.Timer which is running in the UI thread, you have to be carefull when accessing it from an other thread.

In this case you have to invoke the method which calls the Timer like this.
private delegate void EnableTimerDelegate();
private void EnableTimer()
{
	if(InvokeRequired)
	{
		Invoke(new EnableTimerDelegate(EnableTimer), new object[] {});
		return;
	}
	if(!stepTimer.Enabled)
	{
		stepTimer.Enabled = true;
	}
}

Invoke and InvokeRequired are members of Control.

Hope it helps!

All the best,

Martin

GeneralRe: Problem with Timer object Pin
alashara11-Jul-07 23:13
alashara11-Jul-07 23:13 
GeneralRe: Problem with Timer object [modified] Pin
Martin#11-Jul-07 23:28
Martin#11-Jul-07 23:28 
GeneralRe: Problem with Timer object Pin
Luc Pattyn11-Jul-07 23:54
sitebuilderLuc Pattyn11-Jul-07 23:54 
QuestionDate time format Pin
MarkB77711-Jul-07 21:11
MarkB77711-Jul-07 21:11 
GeneralRe: Date time format Pin
Martin#11-Jul-07 21:38
Martin#11-Jul-07 21:38 
Questioninheritance Pin
vamsivss11-Jul-07 20:49
vamsivss11-Jul-07 20:49 
AnswerRe: inheritance Pin
Sathesh Sakthivel11-Jul-07 20:53
Sathesh Sakthivel11-Jul-07 20:53 
AnswerRe: inheritance [modified] Pin
Colin Angus Mackay11-Jul-07 22:50
Colin Angus Mackay11-Jul-07 22:50 
GeneralRe: inheritance Pin
ruanr11-Jul-07 23:56
ruanr11-Jul-07 23:56 
GeneralRe: inheritance [modified] Pin
Colin Angus Mackay12-Jul-07 1:02
Colin Angus Mackay12-Jul-07 1:02 
GeneralRe: inheritance Pin
Colin Angus Mackay12-Jul-07 1:06
Colin Angus Mackay12-Jul-07 1:06 
GeneralRe: inheritance Pin
ruanr12-Jul-07 3:26
ruanr12-Jul-07 3:26 
AnswerRe: inheritance Pin
Naga Rajendra Kumar12-Jul-07 1:25
Naga Rajendra Kumar12-Jul-07 1:25 
Questionarrays Pin
vamsivss11-Jul-07 20:46
vamsivss11-Jul-07 20:46 
AnswerRe: arrays Pin
Sathesh Sakthivel11-Jul-07 20:52
Sathesh Sakthivel11-Jul-07 20:52 
AnswerRe: arrays Pin
ruanr11-Jul-07 20:55
ruanr11-Jul-07 20:55 
GeneralRe: arrays [modified] Pin
Martin#11-Jul-07 20:59
Martin#11-Jul-07 20:59 
GeneralRe: arrays Pin
Sathesh Sakthivel11-Jul-07 21:04
Sathesh Sakthivel11-Jul-07 21:04 
JokeRe: arrays Pin
Luc Pattyn11-Jul-07 23:58
sitebuilderLuc Pattyn11-Jul-07 23:58 
JokeRe: arrays [modified] Pin
Martin#12-Jul-07 0:10
Martin#12-Jul-07 0:10 
AnswerRe: arrays Pin
MarkB77711-Jul-07 21:16
MarkB77711-Jul-07 21:16 
QuestionCOM-Ports Pin
roiter11-Jul-07 20:06
roiter11-Jul-07 20:06 
AnswerRe: COM-Ports Pin
Bekjong11-Jul-07 23:39
Bekjong11-Jul-07 23:39 
QuestionI want SMS of application Pin
srinivassam11-Jul-07 19:00
srinivassam11-Jul-07 19:00 

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.