need help

friendz,

                i have this .net Code

Imports System
Imports System.Management
Imports System.Windows.Forms

Namespace WMISample

    Public Class MyWMIQuery

        Public Overloads Shared Function Main() As Integer

            Try
                Dim searcher As New ManagementObjectSearcher( _
                    "root\WMI", _
                    "SELECT * FROM MSAcpi_ThermalZoneTemperature")

                For Each queryObj As ManagementObject in searcher.Get()

                    Console.WriteLine("-----------------------------------")
                    Console.WriteLine("MSAcpi_ThermalZoneTemperature instance")
                    Console.WriteLine("-----------------------------------")
                    Console.WriteLine("CurrentTemperature: {0}", queryObj("CurrentTemperature"))
                Next
            Catch err As ManagementException
                MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
            End Try
        End Function
    End Class
End Namespace


my problem is :

1)  how to use this code into vb2005 ( pls tell step by step )

2) how can i store the current temperature into variable.

3) i am new for vs2005. so please tell step - by - step. so i can get easily.

4) if any tutorials or code snippets are welcome.

thx.

kamaraj.


Answer this question

need help

  • wdmtaj

    thx Daniel Rieck. Thanx for ur valuable suggestions

  • Stewart Armbrecht

    1. This code should run fine in VB2005. Make sure you have added a reference to System.Management to your project (right-click your project in solution explorer, and select Add refenrece).

     

    2. Dim temp As Double = CDbl(queryObj("CurrentTemperature"))

     

    You need to be more precise on the other questions...



  • need help