title: Text Box User Control in C# Windows Application?
body: <p>In my User Control I have a Text Box which does the validation to take only digits. I place this user control on my form but the Keypress event is not Firing in form.Following is the code in my user control</p>
  
  <pre><code>    protected override void OnKeyPress(KeyPressEventArgs e)
      {
          base.OnKeyPress(e);
          if (this.KeyPress != null)
              this.KeyPress(this, e);
      }
   private void txtLocl_KeyPress(object sender, KeyPressEventArgs e)
      {
          if (e.KeyChar!=(char)Keys.Back)
          {
              if (!char.IsDigit(e.KeyChar))
              {
                  e.Handled = true;
              }
          }
      }
  </code></pre>
  
  <p>but in Form also i want keypress event to fire but it is not firing</p>
  
  <pre><code>public Form1()
      {
          InitializeComponent();
          txtNum.KeyPress += new KeyPressEventHandler(txtPrprCase1_KeyPress);
      }
  
      void txtPrprCase1_KeyPress(object sender, KeyPressEventArgs e)
      {
          MessageBox.Show("KeyPress is fired");
      }
  </code></pre>
  
  <p>but it is not firing. I don't understand what i want to do? It is Urgent for me.</p>