title: C++/CLI: ProgressBar->Value
body: <p>Does anyone know what's wrong with the code below? The <code>this-&gt;progressBar1-&gt;Value</code> part worked by the <code>button_click_event</code> but not in this snippet. I've been messing around with it but to no avail:  </p>
  
  <pre><code>int Trouble ()
  {
  int hour = System::DateTime::Now.Hour;
  this-&gt;progressBar1-&gt;Value = hour;
  return 0;
  }  
  </code></pre>
  
  <p>This code snippet is part of a WinForm and it is located in the <code>#pragma endregion</code> part of my code (BTW This is Visual C++). As always I will apperciate any help or suggestions. Thanks!</p>