Attached is the code(some of it were not mine) and i would like to extend it...
but for some reason, im having problems trapping the "Enter" key,
any help would be very much appreciated...thanks.
Printable View
Attached is the code(some of it were not mine) and i would like to extend it...
but for some reason, im having problems trapping the "Enter" key,
any help would be very much appreciated...thanks.
It seems that the CommandButton "consumes" the Enter key, preventing the Form from ever being notified of the keypress. This happens even when subclassing either the Form or the CommandButton (watching for BN_CLICKED or WM_CHAR/WM_KEYDOWN messages). I've noticed that Microsoft's Calculator doesn't allow setting the focus to any button, thus enabling the Enter key to work correctly. Perhaps you may want to emulate that behavior. Another possible workaround is to use a UserControl button in lieu of the CommandButton.
Been a long time since I did VB6 - but don't you have to enable ENTER key trapping on the properties of the FORM itself?
What are you trying to do with this code?
vb Code:
Dim intIndex As Integer If KeyAscii = vbKeyReturn Then intIndex = 23 cmdCalc(intIndex).SetFocus cmdCalc_Click intIndex End If
press the "Enter" button when the "txt_Paper" has focus?