Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Service net 2005 1

Status
Not open for further replies.

woyler

Programmer
Jun 20, 2001
678
US
Hi all,
I am testing a windows service written in VS.NET 2005. It is a simple code with a timer that ticks every 5 seconds and writes the current time to a file. The service will not do anything after it is installed and running on its own. If I start the service and debug my code, it works fine. I have also copied the code to a VB.NET 2003 enviroment and it works fine there. I am using the same credentials in both apps. As for the 2005 version, I have tried multiple accounts and "allow serivce to interact with desktop" Can anyone shed some light?
regards,
Bill
 
You'll probably need to add some logging to your code to figure out what's happening.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks for the response, but I did fugure it out. In 2003 there are 2 timers , a windows.forms.timer and a system.timers.timer. They are both accessable from the toolbox. One under the components tab, the other under form controls. According to the 2005 documentation, this is the same in vs 2005. However, this is not the case. Both controls are form timers. I had to programmatically add the system.timers.timer and use the elapsed event, rather then the tick event from the forms timer.

regards,
Bill
 
actually there are 3 timers and the best one is hidden away in system.threading.

Christiaan Baes
Belgium

"Time for a new sig." - Me
 
I agree with chrissie1 -- the best timer is Threading.Timer.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Having same problem, could someone post code so I may see how this is done (I'm new and waiting for my appdev training materials to arrive), I am flying by the seat of my pants here. I have managed to create a mobile application so far and figure out printing. Current sample code really helps.
Everything I run into is for 2003 .net and apparently there are some changes.

Thanks
 
'create your timer
Public Yourtimer As New System.Timers.Timer()
'add your event handler, set your interval
Yourtimer .Interval = 5000
Yourtimer .Enabled = True
AddHandler Yourtimer .Elapsed, New System.Timers.ElapsedEventHandler(AddressOf Me.Yourtimer Elapsed)

'create the routine for the click event
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs)

'your
'code
'here
End sub
 
Thank You!!!

You have been a big help. Can't wait to fully learn VS 2005 as much as I do VB6.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top