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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.