TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Matt
NA
3
0
C# Service
Feb 14 2009 12:15 PM
I am new to writing a windows service, could you please have a look at the following code so you can tell me why the timer_tick event never fires?
Thanks :-)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
namespace MyNewService
{
public partial class MyNewService : ServiceBase
{
TextWriter tw = new StreamWriter("log.txt");
public MyNewService()
{
InitializeComponent();
tw.WriteLine(DateTime.Now + " COSHH Service has been installed correctly!");
tw.Close();
}
protected override void OnStart(string[] args)
{
timer1.Start();
}
protected override void OnStop()
{
timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
tw.WriteLine(DateTime.Now + " hello from COSHH Updater!");
tw.Close();
}
}
}
Reply
Answers (
3
)
To change the font of messagebox in C#
how can I write a c# program to draw a league table