Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8304799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:56:18+00:00 2026-06-08T17:56:18+00:00

In form1 i did: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;

  • 0

In form1 i did:

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;
using OpenHardwareMonitor.Hardware;

namespace NvidiaTemp
{
    public partial class Form1 : Form
    {
        Computer computer = new Computer();
        public Form1()
        {
            InitializeComponent();

            computer.Open();
            var temps = new List<decimal>();
            foreach (var hardware in computer.Hardware)
            {
                if (hardware.HardwareType != HardwareType.CPU)
                    continue;
                hardware.Update();
                foreach (var sensor in hardware.Sensors)
                {
                    if (sensor.SensorType != SensorType.Temperature)
                    {
                        if (sensor.Value != null)
                            temps.Add((decimal)sensor.Value);
                    }
                }
            }

            foreach (decimal temp in temps)
            {
                Console.WriteLine(temp);
                MessageBox.Show(temp.ToString());
            }
            Console.ReadLine();




        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

Its never get in to the foreach jump over it.
Tried so many samples examples cant figure out how ot make it work. And im sure my video card support it since if im running the origiran openhardwaremonitor program ikts howing all parameters like temepratures and speeds…

Just downloaded the openhwardwaremonitor.dll file from the official program website:

http://openhardwaremonitor.org/downloads/
the dll is in the directory of the program it self.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:56:20+00:00Added an answer on June 8, 2026 at 5:56 pm

    I broke out ILSpy and took a look at the example exe that ships with the download, as the documentation is quite rudimentary – which is often the case 🙂

    I noticed that when the Computer object is initialized, the boolean properties like GPUEnabled are set to true.

    So…

    Computer myComputer = new Computer();
    
    myComputer.Open();
    
    myComputer.GPUEnabled = true; //This is the line you are missing.
    
    foreach (var hardwareItem in myComputer.Hardware)
    {
    
        if (hardwareItem.HardwareType == HardwareType.GpuNvidia)
        {
            foreach (var sensor in hardwareItem.Sensors)
            {
                if (sensor.SensorType == SensorType.Temperature)
                {
                    MessageBox.Show(String.Format("The current temperature is {0}", sensor.Value));
                }
            }
        }
    
    }
    

    When I run that code from a Windows Forms app on my machine, I get the current temperature (38C, which means I’m obviously not running it hard enough!)

    If I do not set GPUEnabled, I get exactly the same result as you – no items in the IHardware collection.

    UPDATE:

    To answer the other question you posed in the comments, an example like the following should work for you:

        Timer timer;
    
        Computer myComputer;
    
        public Form1()
        {
    
            InitializeComponent();
    
    
    
            myComputer = new Computer();
    
            myComputer.Open();
    
            myComputer.GPUEnabled = true;
    
            timer = new Timer();
            timer.Interval = 5000;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
    
         }
    
        void timer_Tick(object sender, EventArgs e)
        {
            foreach (var hardwareItem in myComputer.Hardware)
            {
    
                if (hardwareItem.HardwareType == HardwareType.GpuNvidia)
                {
                    foreach (var sensor in hardwareItem.Sensors)
                    {
                        if (sensor.SensorType == SensorType.Temperature)
                        {
                            MessageBox.Show(String.Format("The current temperature is {0}", sensor.Value));
                        }
                    }
                }
    
            }
        }
    

    Here we have a Windows.Forms.Timer and the Computer class as class level variables which we initialize in the constructor. Every 5 seconds, the tick event will fire, enumerating the hardware, and displaying a message box with the current temp in. This could easily be a label, and you could even store the Sensor in a class level variable to avoid enumerating the IHardware collection each time.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;
In Form1 i did this: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Diagnostics { class Program {
I am using the namespace System.Windows.Forms.DataVisualization.Charting to create a Chart object on a form.
I have a System.Windows.Forms.ListView control that I was using with View = View.List .
When using the System.Windows.Forms.TableLayoutPanel control on a windows form, it sets the background color
Assume the assembly dll: using Microsoft.SqlServer.Server; using System.Data.SqlClient; using System.Data.SqlTypes; using System; using System.Text;
I have problem with getting username form windows system. I tried using getlogin function
What I did is that, at the top of the Form1 I added a
I have 2 forms : Form1 , Form2 . Form1 has checkedlistbox : checkedlistbox1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.