PC Review


Reply
Thread Tools Rate Thread

Bug with Timers?

 
 
Guest
Posts: n/a
 
      25th Jul 2003
I'm having trouble implementing one of my standard timer
strategies. Because the code for a timer might take an
unspecified amount of time, in VB 6 I disabled the timer
until the timer event code completed.

Now in .NET I'm seeing the timer fire twice in succession,
even though the timer interval is long (1-4 seconds). A
simple project doesn't have this problem, but as more an
more complex it gets, it seems the timer goes haywire.

This is the code I'm using for the timer event is

tmrTurn.Enabled = False
RunMyCode()
Me.stbMain.Text = CurrentDate & " " & CurrentTime
Me.stbMain.Refresh()
tmrTurn.Enabled = True

There are no other references to tmrTurn and this is the
other timer. Doesn't matter the interval, it will always
fire twice before tmrTurn.Enabled=False is executed.

Using VS2003.


 
Reply With Quote
 
 
 
 
Dick Grier
Guest
Posts: n/a
 
      28th Jul 2003
Hi,

I have checked... And, on my system, I get just the single timer event.
Setting the Enabled property to False works as expected.

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timers Earl Partridge Microsoft VB .NET 19 25th Apr 2008 11:24 PM
System.Timers.Timers + WindowsService Björn Microsoft Dot NET Framework 5 17th Jan 2006 02:08 PM
Timers in .NET Ashish Sheth Microsoft Dot NET Framework 2 25th Aug 2004 03:47 PM
RE: Timers not fireing System.Windows.Forms.Timer and System.Timers.Ti =?Utf-8?B?UmljaE0=?= Microsoft Dot NET Framework Forms 3 19th Aug 2004 10:35 AM
Timers Senthil Kumar Microsoft ASP .NET 6 25th Dec 2003 10:50 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:18 AM.