hi, i'm using vb6..
i have a simple problem. all i want to do is to be able to "click" on a button that has focus by hitting the enter key..
i have several command buttons that i can select with the arrow keys but i want to be able to hit ENTER instead of using the mouse..thank you... :D
command button got focusneed help with got focus and key commands
Page 1 of 1
2 Replies - 4503 Views - Last Post: 07 February 2010 - 10:43 PM
Replies To: command button got focus
#2
Re: command button got focus
Posted 04 February 2010 - 03:32 PM
I am confused... Pressing the enter key on a command button that has focus does press it. When the button supposedly has focus, does it have the dotted lines around the edge? If not, it probably does not actually have focus. It would be more useful if you posted an excerpt of your arrow key pressing codes to see whether they are the problem as to why this isn't working for you.
#3
Re: command button got focus
Posted 07 February 2010 - 10:43 PM
Hi justme,
I understand your problem. Use the below code.
Private Sub cmdOK_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then frmMain.Show
End Sub
The above code will display frmMain when you hit ENTER on keyboard while cmdOK is on setfocus.
Hope this helps.
Thanks
I understand your problem. Use the below code.
Private Sub cmdOK_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then frmMain.Show
End Sub
The above code will display frmMain when you hit ENTER on keyboard while cmdOK is on setfocus.
Hope this helps.
Thanks
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|