C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
ObjectQuery type of namespace could not be found Posted by Fruitbat75 on 9 Feb 2009 at 4:40 AM
Ok, I get a name space or type could not be found here's the 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)
        {

        }
    }
}


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

Thanks,

FB



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.