title: Using keyboard shortcuts with LinkLabel controls
body: <p>I've noticed that keyboard-shortcuts assigned to linklabel controls in standard .NET WinForms forms are not functioning.</p>
  
  <p>I have created a LinkLabel control instance and assigned the Text property to be "Select &amp;All". For most controls (label, button, radio button, etc) this would cause <kbd>Alt</kbd>+<kbd>A</kbd> to become the designated keyboard shortcut to trigger the default event (Clicked). This is not happening for the LinkLabel (though it is working okay for other controls)</p>
  
  <ul>
  <li>I have verified that the keyboard shortcut is not a duplicate.</li>
  <li>I have checked to see if the shortcut is setting the focus rather than triggering Clicked. The focus remains unchanged.</li>
  <li>I have verified that the UseMnemonic property is set to true.</li>
  </ul>
  
  <p>Any ideas?</p>
  
  <hr>
  
  <h2>Solution</h2>
  
  <p>Thank you Charlie for the correct answer. Exactly what I needed. I made a slight modification since this code snippet wouldn't compile as-is. <code>LinkLabelLinkClickedEventArgs</code> requires a <code>LinkLabel.Link</code> as a construction parameter rather thank a <code>LinkLabel</code>.</p>
  
  <pre><code>class LinkLabelEx : LinkLabel
  {
      protected override bool ProcessMnemonic(char charCode)
      {
          if (base.ProcessMnemonic(charCode))
          {
              if (this.Links.Count == 0)
                  return false;
              OnLinkClicked(new LinkLabelLinkClickedEventArgs(this.Links[0]));
              return true;
          }
          return false;
      }
  }
  </code></pre>