title: Calculate length of text entered in RichTextBox c# winform
body: <p>I have <code>RichTextBox</code> and I want to calculate the length of text entered in the <code>KeyDown</code> event. The problem is for characters in capital form I have to press <code>Shift</code> which is also getting calculated in the length. See the following code:</p>
  
  <pre><code> private void rtfText_KeyDown(object sender, KeyEventArgs e)
   {
      if (e.Modifiers != Keys.Shift)
          {
              var val = (char)e.KeyValue;
              string  _typed += val;                           
          }
  
  }
  </code></pre>
  
  <p>For texts like <strong>Win</strong> with capital <code>W</code> the length of <code>_typed</code> is shown as <code>4</code> where as it should be <code>3</code>. How to solve this ? I wrote the above code to overcome this but now the length is shown as <code>2</code> instead of <code>3</code> because of suppressing <code>Shift</code>.</p>