title: How to make a factorial program in C++
body: <p>I am new to this website; in fact this is my first question. So if I am asking this question in the wrong context, please inform me so I can make the adjustments.
  I have a program that is created in Visual Studio 2010 to allow a user to enter in an integer from 1 to 10. That user will click a button which in turn should compute and display the integer's factorial value in a text box. I thought everything looks correct but nothing is appearing in the text box. </p>
  
  <p>The following code is what I have been using:</p>
  
  <pre><code>#pragma endregion
          private: System::Void btnFactorial_Click(System::Object^  sender, System::EventArgs^  e) 
          {
              int n;
              int nfact = 1;
              Int32::TryParse(txtNum-&gt;Text, n);
              if (n &gt; 0)
              {
                  for (int i = 1; i &lt;= n; i++)
                      nfact *= i;
                  txtResult-&gt;Text = nfact.ToString();
              }
              else
                  MessageBox::Show ("Please enter a value &gt; 0");      
          }
  
          private: int Factorial (int n)
          {
              if (n == 0)
                  return 1;
              else
                  return n * Factorial (n-1);
          }
      };
  }
  </code></pre>
  
  <p>Can I ask for some help as to what I am doing wrong here?</p>