title: How to: Assign Keys.PageUp to ToolStripMenuItem.ShortcutKeys
body: <pre><code>ToolStripMenuItem mi = new ToolStripMenuItem();
  var value = new KeysConverter().ConvertFromString("PageUp");
  // value = Enum.Parse(typeof (Keys), "PageUp");
  var cast = (Keys) value;
  mi.ShortcutKeys = cast;
  </code></pre>
  
  <p>I'm trying to convert the string "PageUp" into the appropriate <code>System.Windows.Forms.Keys</code> value. 
  However, both parsing approaches (<code>Enum.Parse()</code> vs. <code>KeysConverter.ConvertFromString()</code>) set <code>value</code> to <code>LButton | Space</code>, which leads to an <code>InvalidEnumArgumentException</code> on the last line.</p>
  
  <p>Background:</p>
  
  <ul>
  <li><code>System.Windows.Forms.Keys</code> is a Flags enum</li>
  <li>PageUp has a value of 33, LButton is 1, Space is 32 ==> meaning <code>Enum.Parse</code> works correctly. </li>
  </ul>
  
  <p>How do I correctly parse "PageUp" into <code>Keys.PageUp</code>? </p>
  
  <hr>
  
  <p><strong>Update:</strong><br>
  Silly me. the parsing works correctly. </p>
  
  <pre><code>ToolStripMenuItem mi = new ToolStripMenuItem();
  mi.ShortcutKeys = Keys.PageUp;
  </code></pre>
  
  <p>but this one throws the above mentioned exception.<br>
  So after realising I barked up the wrong tree: </p>
  
  <p>How can one assign <code>Keys.PageUp</code> to <code>ToolStripMenuItem.ShortcutKeys</code>?</p>