Search code examples
.netwindowswinformsaccess-keys

What does an Access Key do for a Label in .NET Windows forms?


Someone enlightened me yesterday to the fact that Labels can have access keys. So I set a Label's text property to Class &A and, indeed, it now has an underline and everything. As far as I can tell, though, Labels can't get the focus.

So what does this Access Key do; if nothing, then why are they allowed anyway (TextBoxes do not have Access Keys)?


Solution

  • When you use Label.UseMnemonic with an "access key", and then press that access key (ie: Alt+A in your example), the control next in the tab order (based on TabIndex) on the form will receive focus.