title: Progress Bar Value > Integer doesn't work in if statement?
body: <p>I have an application I am testing out where audio is played and an action is performed when the audio is played. I have the audio captured in a progress bar which works flawlessly however after I start the program everything will work but the if statement below. Is there something I am missing? I am using NAudio to capture the audio etc as well.</p>
  <p>All audio is going to the progress bar when selecting any audio source and will detect at the right level. When I click on a button in the Windows Form Application it right clicks fine, but when I have audio coming through past a certain level it doesn't right click again which is what I am trying to accomplish.</p>
  <p>Here is the main code which gets the audio and the mouse buttons:</p>
  <pre><code>        [DllImport(&quot;user32.dll&quot;, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
          public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
          private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
          private const int MOUSEEVENTF_RIGHTUP = 0x10;
  
          public void DoMouseClick()
          {
              uint X = (uint)Cursor.Position.X;
              uint Y = (uint)Cursor.Position.Y;
              mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, X, Y, 0, 0);
          }
  
          private WaveIn recorder;
  
          public Form1()
          {
              InitializeComponent();
              recorder = new WaveIn();
              recorder.StartRecording();
              MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
              var devices = enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active);
              audioSourcesList.Items.AddRange(devices.ToArray());
          }
  
          private void timer1_Tick(object sender, EventArgs e)
          {
              if (audioSourcesList.SelectedItem != null)
              {
                  var device = (MMDevice)audioSourcesList.SelectedItem;
                  device.AudioEndpointVolume.Mute = false;
                  Label.Text = (Math.Round(device.AudioMeterInformation.MasterPeakValue * 100)).ToString();
                  progressBar.Value = (int)(device.AudioMeterInformation.MasterPeakValue * 100);
              }
          }
  </code></pre>
  <p>Here is the block that starts the main program and where it seems to not work:</p>
  <pre><code>        private void test()
          {
                  Thread.Sleep(2500);
                  DoMouseClick();
  
              if (progressBar.Value &gt;= 5)
                  {
                      DoMouseClick();
                      Thread.Sleep(2000);
                      DoMouseClick();
                  }
          }
  </code></pre>