7 thg 9, 2016

How to Get workgroup name of computer using C#.net,

For getting information about workgroup of your computer follow step:

1)  Add reference "System.Management"
          (For showing how to add reference click here)
2)  Add name space 
                 using System.Management;

/////////////////   CODE   /////////////////////
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Management;

namespace GetworkegroupCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // Getting information about worke group of computer
            ManagementObjectSearcher mosComputer = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
            foreach (ManagementObject moComputer in mosComputer.Get())
            {
                if (moComputer["Workgroup"] != null)
                     MessageBox.Show(moComputer["Workgroup"].ToString());
            }

        }
    }
}

/////////////////////////////////////////////////////////////////

Download Code : Workgroup.rar
tham khảo tại đây.


How to Get workgroup name of computer using C#.net, Rating: 4.5 Diposkan Oleh: http://pdunoteit.blogspot.com/