ObjectQuery type of namespace could not be found - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

ObjectQuery type of namespace could not be found

Fruitbat75Fruitbat75 Posts: 1Member
Ok, I get a name space or type could not be found here's the code:

[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 Fruitbat
{
public partial class formBase : Form
{
public formBase()
{
InitializeComponent();
operatingSystemTextBox.Text = System.Environment.OSVersion.ToString();
systemNameTextBox.Text = System.Environment.MachineName.ToString();
ObjectQuery queryWin32 = new ObjectQuery("SELECT * FROM Win32_LogicalMemoryConfiguration");

ManagementObjectSearcher queryWin32Output = new ManagementObjectSearcher(queryWin32);

foreach (ManagementObject item in queryWin32Output.Get())
{
Console.WriteLine("Total Space = " + item["TotalPageFileSpace"]);
Console.WriteLine("Total Physical Memory = " + item["TotalPhysicalMemory"]);
Console.WriteLine("Total Virtual Memory = " + item["TotalVirtualMemory"]);
Console.WriteLine("Available Virtual Memory = " + item["AvailableVirtualMemory"]);
}
}

private void label1_Click(object sender, EventArgs e)
{

}

private void resultsBox_TextChanged(object sender, EventArgs e)
{
}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void label2_Click(object sender, EventArgs e)
{

}

private void systemNameTextBox_TextChanged(object sender, EventArgs e)
{

}

private void label2_Click_1(object sender, EventArgs e)
{

}

private void cpuTextBox_TextChanged(object sender, EventArgs e)
{

}
}
}
[/code]

I am using Visual C# 2008 Enterprise... Not sure if that matters.

Thanks,

FB
Sign In or Register to comment.