|
-
Aug 18th, 2006, 08:26 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Using Keypresses instead of Button clicks?
Hi there,
I'm currently creating a music video quiz program, where the user selects from one of four possible answers by clicking upon the corresponding button image or answer label. What I would like to do is have it so that the user can choose to press the keyboard buttons 1, 2, 3 or 4 (along the top of the keyboard preferably) so select an answer, as an alternative to clicking. Can this be done, if so, how do I do this?
When the button corresponding to the answer is clicked, the following code is initiated at present:
VB Code:
Private Sub imgButton_Click(Index As Integer)
'Disables the other buttons and answer labels
For x = 0 To 3
imgButton(x).Enabled = False
lblAnswer(x).Enabled = False
Next x
If loadCorrectNo = (Index + 1) Then
lblAnswer(Index).BackColor = RGB(85, 245, 85)
'Gives the answer a green background and adds to the score before loading a new question
YourScore = YourScore + (10 * QuestionTime)
Else
'Gives the answer a red background before loading a new question
lblAnswer(Index).BackColor = RGB(245, 45, 45)
End If
'Disables the question time counter as the question has been answered
tmrQuestionTime.Enabled = False
tmrNewQuestion.Enabled = True
End Sub
Thanks for any help you can provide,
GT
Last edited by Hack; Aug 21st, 2006 at 10:40 AM.
Reason: Last edited by gt123 : 08-19-2006 at 08:31 AM. Reason: No longer resolved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|