Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › [C#]How to access System.Machine object?
New Posts  All Forums:Forum Nav:

[C#]How to access System.Machine object? - Page 2

post #11 of 20
Quote:
Originally Posted by Licht View Post
Time to revive an old thread.

Your code throws this.

Code:
Error    1    The type or namespace name 'ManagementObjectSearcher' could not be found (are you missing a using directive or an assembly reference?)    C:UsersLichtDocumentsDoubleMarkDoubleMarkForm1.cs    18    9    DoubleMark
Oh, doesnt everyone just love that error? That same error pretty much shows up for everything.

EDIT: Did you say you can't see System.Management namespace when you go to add reference? You need to do that to get it to work. I just checked it in C# express and it was there for me. Let me know. And then of course you have your using System.Management. I tried it. Compiles just fine for me.
Edited by BiG O - 7/10/08 at 6:47pm
post #12 of 20
Thread Starter 
Quote:
Originally Posted by BiG O View Post
Oh, doesnt everyone just love that error? That same error pretty much shows up for everything.

EDIT: Did you say you can't see System.Management namespace when you go to add reference? You need to do that to get it to work. I just checked it in C# express and it was there for me. Let me know.
It is added and throws no errors.
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #13 of 20
Quote:
Originally Posted by Licht View Post
It is added and throws no errors.
Oh ok, so problem solved then?
post #14 of 20
Thread Starter 
Quote:
Originally Posted by BiG O View Post
Oh ok, so problem solved then?
Using System.Machine throws no errors i mean.
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #15 of 20
Quote:
Originally Posted by Licht View Post
Using System.Machine throws no errors i mean.
Well i guess I'm confused then. Because you posted that his code threw errors, but after I added the reference, it was good to go. I feel I'm having trouble understanding what your problem is .
post #16 of 20
Thread Starter 
Quote:
Originally Posted by BiG O View Post
Well i guess I'm confused then. Because you posted that his code threw errors, but after I added the reference, it was good to go. I feel I'm having trouble understanding what your problem is .
Mind showing the enter program code just in case?
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #17 of 20
Quote:
Originally Posted by Licht View Post
Mind showing the enter program code just in case?
Sure...i just typed it up real quick...give me a sec.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        ManagementObjectSearcher Srch1 = new ManagementObjectSearcher("SELECT * FROM Win32_BIOS");
        public void test()
        {
            foreach (ManagementObject mobj in Srch1.Get())
            {
                Console.WriteLine(Srch1.ToString());
            }
        }

        static void Main(string[] args)
        {
        }
    }
}
granted...it does absolutely nothing right now. But I was just trying to get it to compile .(Which it does) i didn't deal with actually calling that test method. In this case you'd have to make it static. Like I said...just getting it to compile.
Edited by BiG O - 7/10/08 at 7:30pm
post #18 of 20
Looks good.
post #19 of 20
Thread Starter 
Very sorry but i have to scrap this for tonight. I see my issue though and i think i can finish it tomorrow.
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
Lee XT
(17 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-6300 Asus M5A97 SAPPHIRE Radeon HD 7850 AMD 4GB DDR3 1333MHZ 
RAMRAMRAMHard Drive
AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ AMD 4GB DDR3 1333MHZ OCZ Vertex 4 256GB 
CoolingOSMonitorKeyboard
Corsair H80 Windows 8.1 Pro MCE Dell P2414H WHXV7  Microsoft Generic 
PowerCaseMouseMouse Pad
Ultra 600W Limited Edition NZXT Black Steel Razer Deathadder Razer Goliath 
Audio
Realtek HD Audio 
  hide details  
Reply
post #20 of 20
Quote:
Originally Posted by Licht View Post
Very sorry but i have to scrap this for tonight. I see my issue though and i think i can finish it tomorrow.
That's fine. Shoot me a PM when you get back to work on it.
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › [C#]How to access System.Machine object?