title: System.InvalidCastException: 'Unable to cast object of type 'System.Windows.Forms.TextBox' to type 'System.IConvertible
body: <p>Trying to make a money counter on C# and getting an error with an integer called costofcredit, i have declared this as an int I then have a button which i click and it will add 1p on and within this button i have the code of<br>
  costofcredit = Convert.ToInt32(textCPC);
  and this is where i get the message below is my whole code</p>
  
  <pre><code>if (textCPC.Text != "0") 
              {
                  onepence = onepence + 1
                  label1p.Text = onepence.ToString(); 
                  totalpence = totalpence + 1; 
                  textTPV.Text = totalpence.ToString(); 
                  totalpounds = totalpence / 100; 
                  textTPVal.Text = totalpounds.ToString("n2"); 
                  costofcredit = Convert.ToInt32(textCPC); 
                  amountofcredits = Convert.ToInt32(totalpence) / costofcredit; 
                  textAPC.Text = amountofcredits.ToString(); 
              else 
              {
                  MessageBox.Show("Please enter the cost per credit!"); 
              }
  </code></pre>