Search
Categories
  ASP.NET
Visual C#
Visual Basic
.NET Framework
ADO.NET
AJAX
LINQ
Java
 
Tutorial Rating
 
3.0 out of 5


Total Votes: 4
         
1 2 3 4 5
 




Display Windows Services in VB.NET

Author: Waqas Anwar - Posted Date: 06-April-2008 - Category: Visual Basic   
Bookmark and Share
.NET Framework 2.0 provides System.ServiceProcess namespace that contains classes developers can use to create and install Windows Services. These classes include ServiceBase, ServiceInstaller and ServiceProcessInstaller. This namespace also contains one class which can display the list of all the Windows Services running on local or remote computer. In this Tutorial I will show you how you can display the list of locally running Windows Services inVB.NET.
 

You can write following code at Form load even to populate listbox control with all locally running Windows Services. You need to import System.ServiceProcess namespace for the code example below.

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim localServices As ServiceController() = ServiceController.GetServices()
    For Each service As ServiceController In localServices
        listBox1.Items.Add(service.DisplayName)
    Next
End Sub


windows_services.gif


Write following code at listbox SelectedIndexChanged Event to get information about currently selected Windows Service.

Private Sub listBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim localServices As ServiceController() = ServiceController.GetServices()
    Dim service As ServiceController = localServices(listBox1.SelectedIndex)
   
    label4.Text = service.DisplayName
    label5.Text = service.ServiceName
    label6.Text = service.Status.ToString()
End Sub



RELATED TUTORIALS

  Display Windows Services in C#
  How to get Windows installed fonts using .NET

LEAVE YOUR COMMENTS LEAVE YOUR COMMENTS
 Name (required)  
 Email (required
 Website


 
POSTED COMMENTS POSTED COMMENTS

sir,
i Create a Windows service in vb.net .by using the system i insert the time value for every one Milli Second
after restart of the System the time Doesn't inserted on the database ,what is the Problem
Posted by arvinth on Monday, August 17, 2009

I need to start a particular services from the Database can u provide a sample
Posted by Srinath Santhanagopalan on Wednesday, July 07, 2010

 


 
 
 

Categories

My Portfolio

Website Links


Copyright @ 2009 EzzyLearning.com