.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Display Service Controller and Status

Posted By:Narayanan       Posted Date: April 12, 2013    Points: 40    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

Today we will discuss about to Display Service Controller and Status of the Service Control in List Box Control using C#.net

Code is here.

Declare namespace for Service Controller
using System.ServiceProcess;
Copy and paste into form_load(wherever you want)

 foreach (ServiceController service in ServiceController.GetServices())
                string status = string.Empty;
                string servicename = string.Empty;
                servicename = service.DisplayName.ToString();
                status = service.Status.ToString();
                listBox1.Items.Add(servicename + "---" + status);



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend