- [DEVEXPRESS] Hỗ trợ tìm kiếm highlight không dấu và không khoảng cách trên Gridview Filter
- [C#] Chia sẻ source code phần mềm Image Downloader tải hàng loạt hình ảnh từ danh sách link url
- [C#] Chụp hình và quay video từ camera trên winform
- [C#] Chia sẽ full source code tách file Pdf thành nhiều file với các tùy chọn
- Giới thiệu về Stock Tracker Widget - Công cụ theo dõi cổ phiếu và cảnh báo giá tăng giảm bằng C# và WPF
- [VB.NET] Chia sẻ công cụ nhập số tiền tự động định dạng tiền tệ Việt Nam
- [VB.NET] Hướng dẫn fill dữ liệu từ winform vào Microsoft word
- [VB.NET] Hướng dẫn chọn nhiều dòng trên Datagridview
- Hướng Dẫn Đăng Nhập Nhiều Tài Khoản Zalo Trên Máy Tính Cực Kỳ Đơn Giản
- [C#] Chia sẻ source code phần mềm đếm số trang tập tin file PDF
- [C#] Cách Sử Dụng DeviceId trong C# Để Tạo Khóa Cho Ứng Dụng
- [SQLSERVER] Loại bỏ Restricted User trên database MSSQL
- [C#] Hướng dẫn tạo mã QRcode Style trên winform
- [C#] Hướng dẫn sử dụng temp mail service api trên winform
- [C#] Hướng dẫn tạo mã thanh toán VietQR Pay không sử dụng API trên winform
- [C#] Hướng Dẫn Tạo Windows Service Đơn Giản Bằng Topshelf
- [C#] Chia sẻ source code đọc dữ liệu từ Google Sheet trên winform
- [C#] Chia sẻ source code tạo mã QR MOMO đa năng Winform
- [C#] Chia sẻ source code phần mềm lên lịch tự động chạy ứng dụng Scheduler Task Winform
- [C#] Hướng dẫn download file từ Minio Server Winform
[C#] Quản lý dịch vụ Windows Services trên Csharp Winform
Xin chào các bạn, bài viết hôm nay mình tiếp tục chia sẻ đến các bạn source code Quản lý các dịch vụ đang chạy trên Window bằng Winform Csharp.
[C#] Control All Services in Windows System
Dưới đây, là giao diện demo ứng dụng Danh sách dịch vụ Windows bằng C#:

Ở giao diện, mình có ba button: refresh, start và stop.
Khi các bạn bấm nút Refresh nó sẻ load tất cả các dịch vụ trên Windows vào Listview.
Bấm nút, start/stop để khởi động hoặc dừng một dịch vụ.
Full source code c# windows services:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ManagerWindowsServices
{
    public partial class Form1 : Form
    {
        private ServiceController serviceController = new ServiceController();
        public Form1()
        {
            InitializeComponent();
            StringExtensions.colorListViewHeader(ref lstServices, ColorTranslator.FromHtml("#c41d7f"), Color.White);
            lstServices.SelectedIndexChanged += LstServices_SelectedIndexChanged;
            lstServices.FullRowSelect = true;
        }
        private void LstServices_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstServices.SelectedItems.Count > 0)
                this.serviceController.ServiceName = lstServices.SelectedItems[0].SubItems[1].Text.Trim();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            GetServices();
        }
        private void GetServices()
        {
            try
            {
                lstServices.Items.Clear();
                ServiceController[] svcs = ServiceController.GetServices();
                foreach (ServiceController svc in svcs)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = svc.DisplayName;
                    item.SubItems.Add(svc.ServiceName);        
                    item.SubItems.Add(svc.Status.ToString());                 
                    lstServices.Items.Add(item);
                }
             
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            GetServices();
        }
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (!this.serviceController.CanStop)
            {
                this.serviceController.Start();
                this.GetServices();
            }
           
        }
        private void btnStop_Click(object sender, EventArgs e)
        {
            if (this.serviceController.CanStop)
            {
                this.serviceController.Stop();
                this.GetServices();
            }
        }
    }
}
Thanks for watching!

![[C#]  Quản lý dịch vụ Windows Services trên Csharp Winform](https://laptrinhvb.net/uploads/users/9a8cb514e4428e85fb4ca07588e9103f.png)

![[C#] Lưu trạng thái các control trên Winform vào Registry Windows](https://laptrinhvb.net/uploads/source/vbnet/save_setting_registry_thumb.png)
![[C#] Hướng dẫn đọc thuộc tính file trong lập trình csharp](https://laptrinhvb.net/uploads/source/image_baiviet/25aaaba21c918e94b1b16a0e11d2b25d.png)
![[C#] Thiết kế ứng dụng Console đẹp với thư viện Spectre.Console](https://laptrinhvb.net/uploads/source/new_image_baiviet/console_app_beauty.png)
![[C#] Tạo hiệu ứng hình ảnh Image Cartoon Effect](https://laptrinhvb.net/uploads/source/csharp/effect_image_cartoon_thumb.png)
![[C#] Hướng dẫn chỉnh Transparent Panel Login form](https://laptrinhvb.net/uploads/source/vbnet/login_transparent.png)
![[C#] Hướng dẫn kiểm tra phiên bản NET Framework cài đặt ở máy tính](https://laptrinhvb.net/uploads/source/new_image_baiviet/check_netframework_csharp.jpg)
![[C#] Kết nôi điện thoại Android, IOS với App Winform via Bluetooth](https://laptrinhvb.net/uploads/source/new_image_baiviet/bluetooth_device.jpg)
![[C#] Hướng dẫn truyền Method vào parametter của function winform](https://laptrinhvb.net/uploads/source/csharp/animation_csharp_thumb.gif)
![[C#] Hiển thị thông báo Toast Message trong lập trình Winform](https://laptrinhvb.net/uploads/source/csharp/toast_message_csharp.png)
![[C#] Liệt kê danh sách file trong thư mục Folder vào mảng Array](https://laptrinhvb.net/uploads/source/csharp/get_list_file_infolder_thumb.jpg)
![[C#] Hướng dẫn fixed lỗi xóa hình ảnh trong csharp](https://laptrinhvb.net/uploads/source/image_baiviet/6d82d92f7643b32d76ae2c4cfd9ab231.png)
![[C#] Kiểm tra kết nối internet Realtime sử dụng Network List Manager của Windows](https://laptrinhvb.net/uploads/source/csharp/detect_internet_realtime_thumb.jpg)
![[C#] Hướng dẫn viết ứng dụng ẩn và hiện Taskbar Windows](https://laptrinhvb.net/uploads/source/image_baiviet/ce1585bdf428bd1d3f0ae16de0a25b65.png)
![[C#] Hiệu ứng Water Effect Image cho Banner](https://laptrinhvb.net/uploads/source/csharp/water_effect_thumb.gif)
![[C#] Khóa shortcut key trên bàn phím winform](https://laptrinhvb.net/uploads/source/csharp/lock_shortcut_key_thumb.png)
![[C#] Hướng dẫn convert HTML code sang PDF File trên NetCore 7 Winform](https://laptrinhvb.net/uploads/source/new_image_baiviet/HTML_TO_PDF_NETCORE.png)
![[C#] Chia sẻ source code tạo hiệu ứng pixel Image trên winform](https://laptrinhvb.net/uploads/source/new_image_baiviet/effect_pixel_image_thumb.png)
![[C#] Hướng dẫn tạo shortcut nhanh cho ứng dụng  đang chạy](https://laptrinhvb.net/uploads/source/csharp/short_cut_app_windows_thumb.png)
![[C#] Hướng dẫn bắt sự kiện click chuột phải và chuột giữa winform](https://laptrinhvb.net/uploads/source/vbnet/mouse_click_envent.jpg)
![[C#] Tìm kiếm xem danh sách từ khóa có tồn tại trong đoạn văn bản hay không](https://laptrinhvb.net/uploads/source/new_image_baiviet/web_client_download_string.png)
![[C#] Chia sẻ SDK lập trình với máy chấm công Aikyo](https://laptrinhvb.net/uploads/source/DATABASE/aikyo_sdk.jpg)
![[C#] Hướng dẫn tạo mã tự động trên lập trình Winform](https://laptrinhvb.net/uploads/source/vbnet/AUTO_CODE.png)
![[C#] Chia sẽ source code Matrix Rain trên Console](https://laptrinhvb.net/uploads/source/vbnet/matrix_rain_console.png)
![[C#] Tự động khóa ứng dụng hoặc thoát sau khoảng thời gian không sử dụng (Automatic Logout)](https://laptrinhvb.net/uploads/source/csharp/automatic_logout_csharp_thumb.png)

