title: How to sum two numbers using a Userform and output it in a MsgBox?
body: <p>I have created a userform with three textboxes.</p>
  
  <p>The first textbox is for the first number, the second for entering the second number, and the last one is the result.</p>
  
  <p>I have create a button named Calculate.</p>
  
  <p>I have this code for textbox1:</p>
  
  <pre><code>Private Sub TextBox1_Change()
  Dim a As Integer
  a = Val(TextBox1.Text)
  End Sub
  </code></pre>
  
  <p>and this for textbox2:</p>
  
  <pre><code>Private Sub TextBox2_Change()
  Dim b As Integer
  b = Val(TextBox2.Text)
  End Sub
  </code></pre>
  
  <p>and I have a button which shows the result</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  Dim c As Integer
  c = a + b
  MsgBox (c)
  End Sub
  </code></pre>
  
  <p>I enter 1 for textbox1 and 2 for textbox2, 1+2 will be 3, but in the MsgBox I 
  see 0. Why is this, and how can I fix it?</p>