title: Want to add Keyboard input to my calculator. Also hide the mouse cursors?
body: <p>I am new to c#. I built a simple calculator. But it does not have keyboard input. How to enable it? </p>
  
  <ol>
  <li><p>I want to get 5 in the text box when number 5 s pressed from keyboard. </p></li>
  <li><p>Also i want to hide mouse cursor in text field. Now when the application stars, mouse cursor appears in the text field.</p></li>
  </ol>
  
  <p>This is my code:</p>
  
  <pre><code>namespace MyCalculator
  {
      public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
          //textBox1.Text = "0";
  
  
      }
  
      double num1=0, num2, result;
      string op;
  
      private void button_plus_Click(object sender, EventArgs e)
      {
          if (textBox1.Text != "") 
              num1 = Convert.ToDouble(textBox1.Text);
  
          textBox1.Text = String.Empty;
          op = "+";
  
      }
  
      private void button_minus_Click(object sender, EventArgs e)
      {
          if (textBox1.Text != "")
               num1 = Convert.ToDouble(textBox1.Text);
  
          textBox1.Text = String.Empty;
          op = "-";
  
      }
  
      private void button_mul_Click(object sender, EventArgs e)
      {
          if (textBox1.Text != "") 
                num1 = Convert.ToDouble(textBox1.Text);
  
          textBox1.Text = String.Empty;
          op = "*";
  
      }
  
      private void button_div_Click(object sender, EventArgs e)
      {
          if (textBox1.Text != "") 
                   num1 = Convert.ToDouble(textBox1.Text);
  
          textBox1.Text = String.Empty;
          op = "/";
  
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "1";
      }
  
      private void button2_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "2";
      }
  
      private void button3_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "3";
      }
  
      private void button4_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "4";
      }
  
      private void button5_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "5";
      }
  
      private void button6_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "6";
      }
  
      private void button7_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "7";
      }
  
      private void button8_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "8";
      }
  
      private void button9_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "9";
      }
  
      private void button0_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "0";
      }
  
      private void button00_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + "00";
      }
  
      private void button_point_Click(object sender, EventArgs e)
      {
          textBox1.Text = textBox1.Text + ".";
      }
  
      private void button_clear_Click(object sender, EventArgs e)
      {
          textBox1.Text = String.Empty;
      }
  
      private void button_result_Click(object sender, EventArgs e)
      {
          calculate(op);
  
      }
  
      public void calculate( string op)
      {
          num2 = Convert.ToDouble(textBox1.Text);
          switch(op)
          {
              case "+" : result=num1+num2;
                  textBox1.Text = result.ToString(); break;
              case "-": result = num1 - num2;
                  textBox1.Text = result.ToString(); break;
              case "*": result = num1 * num2;
                  textBox1.Text = result.ToString(); break;
              case "/": result = num1 / num2;
                  textBox1.Text = result.ToString(); break;
  
          }
          num1 = 0; num2 = 0;            
      }
  
      private void textBox1_TextChanged(object sender, EventArgs e)
      {
  
          textBox1.Font = new Font("Arial",12, FontStyle.Bold);
          textBox1.Cursor = Cursors.Arrow;
  
  
      }
  
  
  }
  </code></pre>
  
  <p>}</p>