title: NullReferenceException was unhandled, Object Reference not set to an instance of an object
body: <p>Whenever I run my program, I get: NullReferenceException was unhandled, Object Reference not set to an instance of an object.</p>
  
  <p>When I start the program, I have a form appear called MaxScore where the user enters the max score and presses OK. In the OK event, I call a method from MainForm to update the maxGameCountLabel on MainForm with the value entered for the max score, as a parameter.</p>
  
  <p>When I press ok, I get the NullReferenceException at </p>
  
  <pre><code>myGameCountLbl.Text = maxGames.ToString();
  </code></pre>
  
  <p>of my maxGameCountLblUpdate method.</p>
  
  <p>Here is the maxGameCountLblUpdate method code which resides in MainForm:</p>
  
  <pre><code>//Update game count label 
  public void maxGameCountLblUpdate(decimal maxGames)
  {
      maxGames = decimal.ToInt32(maxGames);
      myGameCountLbl.Text = maxGames.ToString();
      compGameCountLbl.Text = maxGames.ToString();
  }
  </code></pre>
  
  <p>Here is my OK Button event on MaxScore:</p>
  
  <pre><code>private void okBtn_Click(object sender, EventArgs e)
  {
      MainForm.maxGameCountLblUpdate(max);
  }
  </code></pre>
  
  <p>Note, I have set</p>
  
  <pre><code>public Form1 MainForm { get; set; }
  </code></pre>
  
  <p>in MaxScore</p>
  
  <p>And I create MaxScore in MainForm with:</p>
  
  <pre><code>    using (MaxScore scoreForm = new MaxScore())
      {
          scoreForm.MainForm = this;
          scoreForm.ShowDialog();
      }
  </code></pre>
  
  <p>I can't get this to work.. I have tried many things.. 
  Thanks!</p>
  
  <p>EDIT: After adding a breakpoint at myGameCountLbl.Text = maxGames.ToString();
  myGameCountLbl appears to be coming up as null... Im sorry for being a newb... How do I fix this? maxGames, indeed, does come up as 1, so that is not the problem</p>