title: Forms, basic calculator key triggering problem
body: <pre><code> private void UserInputText_KeyDown(object sender, KeyEventArgs e)
      {
          if ((e.KeyCode == Keys.D4 &amp;&amp; e.Modifiers == Keys.Shift) || (e.KeyCode == Keys.Add))
          {
              if (String.IsNullOrEmpty(UserInputText.Text))
              {
                  MessageBox.Show(&quot;Bir sayı giriniz.&quot;);
                  UserInputText.Clear();
                  return;
              }
              if (double.TryParse(UserInputText.Text, out sayı1))
              {
                  CalculationResultText.Text = sayı1 + &quot; + &quot;;
                  islem = &quot;+&quot;;
                  UserInputText.Clear();
              }
              else
              {
  
                  MessageBox.Show(&quot;Sadece sayı değeri girebilirsiniz.&quot;);
                  UserInputText.Clear();
              }
          }
      }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/iDFse.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iDFse.png" alt="enter image description here" /></a></p>
  <p>I am coding a basic forms calculator. I am trying to trigger addition function and clear the textbox when textbox is focused and user presses &quot;+&quot; key.  &quot;<code>if (String.IsNullOrEmpty(UserInputText.Text))</code> and <code>else</code> conditions work well. But if no Message boxes shows up as in the
  <code>if (double.TryParse(UserInputText.Text, out sayı1))</code> condition, the &quot;+&quot; character remains in the textbox as in the image. Thanks for help.</p>