Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 17th, 2004, 02:55 AM
Friend of Wrox
Join Date: Jul 2003
Location: York, , United Kingdom.
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Default Timers in a Windows Service

I have a fairly simple windows service I've designed, but after deploying it I found it wasn't working. After a bit of messing about I got remote debugging working, and found that the reason was that the timer wasn't ticking. I created a new service, which would write to a text file on every timer tick (once every 60,000 milliseconds, or 1 minute), and this doesn't work either.

Now the timer.enabled property defaults to false, but in the OnStart sub I set it to true and again in the OnStop I set it to false. The timer is definitely enabled, because I also put Pause and Continue routines in the first service and when stepping though these, the timer.enabled property does change (and is set to true when exiting the Continue routine).

Anyone else encountered a similar problem?

Reply With Quote
  #2 (permalink)  
Old June 17th, 2004, 03:04 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

Did you also start the timer? e.g.:


I think this method is new in .NET. In classic VB, setting it to enabled meant it would start automatically (at least I think that was the case), but in the .NET world you have to start it yourself.


Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Back To School by Jon & Vangelis (Track 6 from the album: The Friends Of Mr. Cairo) What's This?
Reply With Quote
  #3 (permalink)  
Old June 18th, 2004, 05:31 AM
Friend of Wrox
Join Date: Jul 2003
Location: York, , United Kingdom.
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts

Nope, realised that I was using a System.Windows.Forms.Timer rather than a System.Timers.Timer (how stupid of me!). I can't really understand why the dot net designers thought having two timer classes that both perform in almost identical ways was a good idea, but what do I know...

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Impersonate with windows service for Service A/C vinod_yadav1919 C# 0 October 18th, 2008 02:29 PM
Accessing Windows service from a windows app sajid08 C# 1 October 6th, 2006 10:25 AM
Windows Service hunghung General .NET 3 January 20th, 2005 01:43 PM
c# timers donbes C# 0 June 19th, 2003 11:19 AM

All times are GMT -4. The time now is 02:25 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.