title: Getting a value of 0 when dividing 2 longs in c#
body: <p>I am trying to divide the values of DriveInfo.AvailableFreeSpace &amp; DriveInfo.TotalSize to try and get a percentage of it to use in a progress bar.</p>
  
  <p>I need the end value to be an int as progressbar.value requires an int and the above methods return a long.</p>
  
  <p>I have this as the values: </p>
  
  <p>164660715520---AvailableFreeSpace</p>
  
  <p>256058060800---TotalSize</p>
  
  <p>When I try and set the progressbar.value using this method I also get an error:</p>
  
  <p>progressBar1.Value=(int)(dInfo.AvailableFreeSpace/dInfo.TotalSize)*100;</p>
  
  <p>When I use this code to try and get a value it just returns a 0.</p>
  
  <pre><code>label10.Text =  (((int)dInfo.AvailableFreeSpace/dInfo.TotalSize)*100).ToString();
  </code></pre>
  
  <p>I've even tried this and it doesn't work:</p>
  
  <pre><code>label10.Text = ((dInfo.AvailableFreeSpace/dInfo.TotalSize)*100).ToString();
  </code></pre>
  
  <p>I know I still have to do some formatting to get it to look good but whenever I run the code it just returns a 0.</p>
  
  <p>Could it have something to do with the conversion from long to int?</p>