How to Get processor name using C#.net,How to get information about processor using C#.net

For getting information about processor 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 HaardDiskInfoCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
             ManagementObjectSearcher mosProcessor = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");

            foreach (ManagementObject moProcessor in mosProcessor.Get())
            {
               
                if(moProcessor["maxclockspeed"]!=null)
                    lblPMCSpeed.Text = moProcessor["maxclockspeed"].ToString();
                if(moProcessor["datawidth"]!=null)
                    lblPDataWidth.Text = moProcessor["datawidth"].ToString();
                if(moProcessor["name"]!=null)
                    lblPName.Text=moProcessor["name"].ToString();
                if(moProcessor["manufacturer"]!=null)
                    lblPManufacture.Text = moProcessor["manufacturer"].ToString();


            }

          }
      }
}

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

Download Code : ProcessorInfo.rar

See Also :
  Follow Me On Facebook

--
/\/ir@\/  <(.'.)>

Comments

Post a Comment

Popular posts from this blog

How to get column value from the selected row in data grid in wpf c#.net

How to make and use web service in Microsoft Dynamics Navision.

How to use Format function in Microsoft Dynamics Navision.