
Using label control to change focus
Quote:
>I have a label for a field with the caption of "&Start". What I want to do is
>to use the Alt-S combo to set the focus to the field (called txtStartDate) that
>the label refers to. What event is triggered when the user presses Alt-S???
Here's an example from an email program I'm writing. I have an array of
four single-line edit controls for the header lines. This is the code from
the KEYDOWN event of the array.
In general, you need code like this in the KEYDOWN event of every control
from which you want to jump to your field.
----------------------------------------------------------
If Shift = 4 Then 'alt key
Select Case KeyCode
Case Asc("T")
txtMailHeader(TO_HEADER).SetFocus
Case Asc("S") 'subject
txtMailHeader(SUBJECT_HEADER).SetFocus
Case Asc("C") 'cc
txtMailHeader(CC_HEADER).SetFocus
Case Asc("A") 'attach
txtMailHeader(ATTACH_HEADER).SetFocus
End Select
End If
----------------------------------------------------------
Remember: the label is just a picture -- it informs the user, but plays no
part in the code.
David
--
____D__a__v__i__d_____B__e__r__g__a__r__t___________________________________
please note new address ^