I'm New In c# and want to create a windows service
here what I'm trying

public TestService()  
        {  
            InitializeComponent();  
            timeDelay = new System.Timers.Timer();  
            timeDelay.Elapsed += new System.Timers.ElapsedEventHandler(WorkProcess);  
        }  
        public void WorkProcess(object sender, System.Timers.ElapsedEventArgs e)  
        {  
            string process = "Timer Tick " + count;  
            LogService(process);  
            count++;  
        }  
        protected override void OnStart(string[] args)  
        {  
            LogService("Service is Started");  
            timeDelay.Enabled = true;  
        }  
        protected override void OnStop()  
        {  
            LogService("Service Stoped");  
            timeDelay.Enabled = false;  
        }  
        private void LogService(string content)  
        {  
            FileStream fs = new FileStream(@ "d:\TestServiceLog.txt", FileMode.OpenOrCreate, FileAccess.Write);  
            StreamWriter sw = new StreamWriter(fs);  
            sw.BaseStream.Seek(0, SeekOrigin.End);  
            sw.WriteLine(content);  
            sw.Flush();  
            sw.Close();  
        }  




    Can any body help me step by step guide
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.