Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to bind control’s properties to variables in C#? Pin
Luc Pattyn3-Feb-10 9:59
sitebuilderLuc Pattyn3-Feb-10 9:59 
GeneralRe: How to bind control’s properties to variables in C#? Pin
PomaPomaPoma3-Feb-10 11:12
PomaPomaPoma3-Feb-10 11:12 
AnswerRe: How to bind control’s properties to variables in C#? Pin
Not Active3-Feb-10 9:32
mentorNot Active3-Feb-10 9:32 
GeneralRe: How to bind control’s properties to variables in C#? Pin
PomaPomaPoma3-Feb-10 10:09
PomaPomaPoma3-Feb-10 10:09 
GeneralRe: How to bind control’s properties to variables in C#? Pin
Not Active3-Feb-10 10:17
mentorNot Active3-Feb-10 10:17 
QuestionC# code clean up and improvement Pin
eeffoc423-Feb-10 5:20
eeffoc423-Feb-10 5:20 
AnswerRe: C# code clean up and improvement Pin
Luc Pattyn3-Feb-10 5:26
sitebuilderLuc Pattyn3-Feb-10 5:26 
GeneralRe: C# code clean up and improvement [modified] Pin
eeffoc423-Feb-10 5:50
eeffoc423-Feb-10 5:50 
Here is some of the code I used to get some BIOS info and display it.
//Perform the search for WMI Info
private void SearchWMI_Data(string hostName)
{
    this.listBox1.Items.Clear();
    this.queueStack.Clear();

    string myString = "";
    string target = hostName;
    long ramSize = 0;
    IPAddress[] myIP = Dns.GetHostAddresses(target);

    try
    {
        if (!this.ValidateHostInput(hostName)) return;
        {
            ManagementScope scope = new ManagementScope("\\\\" + target + "\\root\\cimv2");
            ManagementPath pathBios = new ManagementPath("Win32_Bios");
            ManagementPath pathSystem = new ManagementPath("Win32_ComputerSystem");
            ObjectGetOptions obj = new ObjectGetOptions(null);

            ManagementClass wmiBios = new ManagementClass(scope, pathBios, obj);
            ManagementClass wmiSystem = new ManagementClass(scope, pathSystem, obj);

            foreach (IPAddress theIP in myIP)
            {
                queueStack.Enqueue("IP Address: " + theIP.ToString());
            }

            foreach (ManagementObject bios in wmiBios.GetInstances())
            {
                //Add info to a Queue stack
                queueStack.Enqueue("");
                queueStack.Enqueue("=== BIOS Info ===");
                try
                {
                    queueStack.Enqueue("Manufacturer: " + bios.Properties["Manufacturer"].Value.ToString().Trim());
                }
                catch
                {
                    queueStack.Enqueue("Manufacturer: Error reading status");
                }
                try
                {
                    queueStack.Enqueue("SN: " + bios.Properties["Serialnumber"].Value.ToString().Trim());
                }
                catch
                {
                    queueStack.Enqueue("SN: Error reading status");
                }
            }

            //Get data from the Queue stack
            while (this.queueStack.Count > 0)
            {
                this.listBox1.Items.Add(this.queueStack.Dequeue());
            }
        }
        txtBoxHostName.Focus();
    }
    catch
    {
        this.listBox1.Items.Add("Unable to find the specified computer: " + hostName.ToUpper());
        txtBoxHostName.Focus();
    }
}


modified on Wednesday, February 3, 2010 12:27 PM

GeneralRe: C# code clean up and improvement Pin
Luc Pattyn3-Feb-10 6:26
sitebuilderLuc Pattyn3-Feb-10 6:26 
GeneralRe: C# code clean up and improvement Pin
eeffoc423-Feb-10 9:17
eeffoc423-Feb-10 9:17 
GeneralRe: C# code clean up and improvement Pin
Luc Pattyn3-Feb-10 9:54
sitebuilderLuc Pattyn3-Feb-10 9:54 
AnswerRe: C# code clean up and improvement Pin
Md. Marufuzzaman3-Feb-10 6:27
professionalMd. Marufuzzaman3-Feb-10 6:27 
Questionasalamalikum! Pin
ayeshazahoor3-Feb-10 4:43
ayeshazahoor3-Feb-10 4:43 
Questionhello every one Pin
japrasath3-Feb-10 4:03
japrasath3-Feb-10 4:03 
AnswerRe: hello every one Pin
tonyonlinux3-Feb-10 4:13
tonyonlinux3-Feb-10 4:13 
AnswerRe: hello every one Pin
Not Active3-Feb-10 4:33
mentorNot Active3-Feb-10 4:33 
AnswerRe: hello every one Pin
Abhinav S3-Feb-10 5:47
Abhinav S3-Feb-10 5:47 
AnswerRe: hello every one Pin
Wamuti3-Feb-10 9:07
Wamuti3-Feb-10 9:07 
QuestionInserting a record into a Multi-table database using linq to sql in c# [modified] Pin
tonyonlinux3-Feb-10 3:58
tonyonlinux3-Feb-10 3:58 
AnswerRe: Inserting a record into a Multi-table database using linq to sql in c# Pin
Not Active3-Feb-10 4:35
mentorNot Active3-Feb-10 4:35 
QuestionForms Slowness Pin
Syed Shahid Hussain3-Feb-10 3:09
Syed Shahid Hussain3-Feb-10 3:09 
AnswerRe: Forms Slowness Pin
OriginalGriff3-Feb-10 3:19
mveOriginalGriff3-Feb-10 3:19 
GeneralRe: Forms Slowness Pin
Syed Shahid Hussain3-Feb-10 3:28
Syed Shahid Hussain3-Feb-10 3:28 
GeneralRe: Forms Slowness Pin
OriginalGriff3-Feb-10 3:39
mveOriginalGriff3-Feb-10 3:39 
GeneralRe: Forms Slowness Pin
Syed Shahid Hussain3-Feb-10 3:48
Syed Shahid Hussain3-Feb-10 3:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.