title: Keypress modifiers in a DataGridView with and without data
body: <p>I am trying to implement a CTRL+C Copy operation in a usercontrol derived from a DataGridView.</p>
  
  <p>I want Ctrl+C to copy the selected cells in the datagridview, and Ctrl+Shift+C to copy the selected cells <strong>and</strong> the cell column header text.</p>
  
  <p>I have set up two copy routines, and they work fine.  The problem I am having is assigning the key_down handlers.</p>
  
  <p>Here is my keyDown code:</p>
  
  <pre><code> protected virtual void DataGridViewEx_KeyDown(object sender, KeyEventArgs e)
      {
          System.Diagnostics.Debug.WriteLine("-------------------------------");
          System.Diagnostics.Debug.WriteLine("KeyCode = " + e.KeyCode.ToString());
          System.Diagnostics.Debug.WriteLine("KeyValue = " + e.KeyValue.ToString());
          System.Diagnostics.Debug.WriteLine("KeyData = " + e.KeyData.ToString());
          System.Diagnostics.Debug.WriteLine("Modifiers = " + e.Modifiers.ToString());
          System.Diagnostics.Debug.WriteLine("-------------------------------");
  
  
          if ((e.Control &amp; e.Shift) &amp;&amp; e.KeyCode == Keys.C)
          {
              System.Diagnostics.Debug.WriteLine("CTRL+SHIFT+C Pressed");
              CopyToClipboard(CopyMode.SelectedCellsWithHeaders);
              e.Handled = true;
          }
          if (e.Control &amp;&amp; e.KeyCode == Keys.C)
          {
              System.Diagnostics.Debug.WriteLine("CTRL+C Pressed");
              CopyToClipboard(CopyMode.SelectedCellsOnly);
              e.Handled = true;
          }
  
          else if (e.Control &amp;&amp; e.KeyCode == Keys.V)
          {
              PasteClipboard();
              e.Handled = true;
          }
      }
  </code></pre>
  
  <p>Now:  Here is the bit I don't understand:
  When I try this on an empty grid (i.e. no data, columns etc), I get the following:</p>
  
  <p>Ctrl+C:</p>
  
  <blockquote>
    <p>KeyCode = C
    KeyValue = 67
    KeyData = C, Shift, Control
    Modifiers = Shift, Control</p>
  </blockquote>
  
  <p>Ctrl+Shift+C</p>
  
  <blockquote>
    <p>KeyCode = C
    KeyValue = 67
    KeyData = C, Shift, Control
    Modifiers = Shift, Control</p>
  </blockquote>
  
  <p>BUT:  Once I've pasted data into the grid, the exact same keydown operations yield this:</p>
  
  <p>Ctrl+C</p>
  
  <blockquote>
    <p>KeyCode = C
    KeyValue = 67
    KeyData = C, Control
    Modifiers = Control</p>
  </blockquote>
  
  <p>Ctrl+Shift+C</p>
  
  <blockquote>
    <p>KeyCode = ShiftKey 
    KeyValue = 16 
    KeyData = ShiftKey, Shift, Control
    Modifiers = Shift, Control</p>
  </blockquote>
  
  <p>The "C" Keypress is no longer being recognized when there is data in the grid, and I am only getting the Ctrl+Shift.  </p>
  
  <p>The cells aren't in edit mode (you can see that Ctrl+C works fine).  I can change it to something like Ctrl+K instead, but I would like to understand what may be happening here.  Any ideas?</p>