title: How to reference an object of a class in a statement?
body: <p>At the top of my form I have:</p>
  
  <pre><code>public static int hoursInt;
  public static int minutesInt;
  public static int secondsInt;
  public static int CompletedIn24;
  </code></pre>
  
  <p>Then further down I have the following to reset the <code>numericUpDown</code> boxes to zero when selecting a new runner:</p>
  
  <pre><code>private void lstRunners_SelectedIndexChanged(object sender, EventArgs e)
  {
  
  Runner selectedRunner = (Runner)lstRunners.SelectedItem;
  
  numericUpDown1.Value = 0;
  numericUpDown2.Value = 0;
  numericUpDown3.Value = 0;
  }
  </code></pre>
  
  <p>Then in the <code>Finish</code> button click event I have:</p>
  
  <pre><code> hoursInt = Convert.ToInt32(numericUpDown1.Value);
   minutesInt = Convert.ToInt32(numericUpDown2.Value);
   secondsInt = Convert.ToInt32(numericUpDown3.Value);
  
  if (lstRunners.SelectedIndex &gt; -1 &amp;&amp; hoursInt + minutesInt + secondsInt != 0)
          {
              // Obtain selected climber
              Runner selectedRunner = (Runner)lstRunners.SelectedItem;
              selectedRunner.Hours = hoursInt;
              selectedRunner.Minutes = minutesInt;
              selectedRunner.Seconds = secondsInt;
  
              var expertRunner = selectedRunner as Expert;
              if (expertRunner != null)
              {
                  expertRunner.UponFinish();
              }
  </code></pre>
  
  <p>Here is my overriden method in <code>Expert : Runner</code>:</p>
  
  <pre><code>public override void UponFinish()
          {
              base.UponFinish();
  
              // The integer must increment by one if the time is 24:00:00 or less i.e. 23:59:59 would increment the integer as well
              if (Hours &lt; 24 || (Hours == 24 &amp;&amp; Minutes == 0 &amp;&amp; Seconds == 0))
              {
                  CompletedIn24++;
              }
          }
  </code></pre>
  
  <p>At present the <code>UponFinish()</code> method in <code>Runner</code> doesn't have anything inside the braces as I'm not sure if anything is required?</p>
  
  <p>I tried to output the <code>CompletedIn24</code> integer to a string to see if it would work when the button is clicked but the value stayed at zero even if an expert runner was selected and the time was 24:00:00 or less. The integer is not incrementing and I'm not sure what is causing the problem?</p>
  
  <p>Any help would be appreciated.</p>