For getting information about workgroup of your computer follow step:
-- /\/ir@\/ <(.'.)>
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
See Also :
(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
See Also :
- How to Get operating system name using C#.net,How ...
- How to Get processor name using C#.net,How to get information about processor using C#.net
- How to upaload image with resize it, How to resize uploaded image and save
- How to get computer name using c#.net
- How to upload and save image in asp.net ?
Ur Post is really helping me.
ReplyDeleteYour Post is really helpfull to me...Thanx.
ReplyDelete