Disk Utilization with DriveInfo[]
<p>EDIT 9:20am CST: It appears you just have to convert</p>

<pre><code>   if (d.Name == drvNamefrm2)
</code></pre>

<p>to        </p>

<pre><code>    if (d.Name == (string)drvNamefrm2)
</code></pre>

<hr>

<p>Alright, I am trying to write a small performance monitor. I've done research on here and worked through some walk-thrus. This is probably a small problem with an easy fix, but I can't see it. I was hoping you could take a look.</p>

<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;


namespace TrafcLightPerfMeter_v1
  {
public partial class diskUtilForm : Form
{
</code></pre>

<p>It uses two forms and I am bringing over the initial selection from Form1 hence the parameters in the form name below.</p>

<pre><code>    public diskUtilForm(int drvNumfrm1, string drvNamefrm1)
    {
        InitializeComponent();
        mainForm test = new mainForm();
        **object drvNumfrm2 = (object)drvNumfrm1;
        object drvNamefrm2 = (object)drvNamefrm1;
        DriveInfo[] allDrives = DriveInfo.GetDrives();
</code></pre>

<p>It's this "foreach" section. It is skipping over my "if" even if the d.Name is == to drvNamefrm2 --  I don't understand what I am doing wrong. </p>

<p>The idea here is "if" they match "then" the traffic light background will be green. Then I want to use that little formula to designate the rest of the colors. I just need it to enter the if statement.</p>

<pre><code>   foreach (DriveInfo d in allDrives)
        {
         if (d.Name == drvNamefrm2)
            {
                labelGreen.BackColor = Color.Green;
                long totalAvailable = d.AvailableFreeSpace;
                long totalSpace = d.TotalSize;

        double percentAvailable =   Math.Round(((double)totalAvailable/(double)totalSpace)*100,4);**

            }
        }

    }
}
 }
</code></pre>

<p>Thank you in advance for any input.</p>
