title: Addition using a single TextBox
body: <p>I am writing a c# windowsform application for addition of two entries in a single text box. </p>
  
  <p>I have 1 text box, 1 add button and 1 result button. </p>
  
  <p>I need to achieve following algo, </p>
  
  <ol>
  <li><p>User enter the no in text box. It will be stored in <code>int n1</code>. </p></li>
  <li><p>User will press add button. At this time the content of the <code>textbox.text</code> will be get cleared and user must be able to enter the secound value in it. </p></li>
  <li><p>This secound value will get stored in <code>int n2</code>. </p></li>
  <li><p>Now when user click on result button he should get <code>int result=n1+n2</code> </p></li>
  </ol>
  
  <p>I have written following in add buttons's click event, </p>
  
  <pre><code>n1=convert.Int32(textbox1.text); 
  
  textbox1.text=""; 
  
  
  n2=convert.Int32(textbox1.text);//exception occures here 
  </code></pre>
  
  <p>And result button's click event has, </p>
  
  <pre><code>textbox1.text=result.tostring(); 
  </code></pre>
  
  <p>I leanred the working of this program and find out that it is due to <code>NULL</code> value assignment to <code>int n2</code>. </p>
  
  <p>I am bit confused how can I achieve above problem using single textbox? </p>
  
  <p>Is there any way to provide the textbox.txt value through user through textbox field only? </p>
  
  <p>Is there any property of textbox which I need to set? </p>
  
  <p>I am very new to .net! Please help! </p>
  
  <p>Thanks in advance for your kind attention! </p>