Results 1 to 24 of 24

Thread: [RESOLVED] Using Keypresses instead of Button clicks?

Threaded View

  1. #1

    Thread Starter
    Addicted Member gt123's Avatar
    Join Date
    May 2006
    Location
    United Kingdom
    Posts
    145

    Resolved [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:
    1. Private Sub imgButton_Click(Index As Integer)
    2.     'Disables the other buttons and answer labels
    3.         For x = 0 To 3
    4.             imgButton(x).Enabled = False
    5.             lblAnswer(x).Enabled = False
    6.         Next x
    7.            
    8.         If loadCorrectNo = (Index + 1) Then
    9.             lblAnswer(Index).BackColor = RGB(85, 245, 85)
    10.     'Gives the answer a green background and adds to the score before loading a new question
    11.             YourScore = YourScore + (10 * QuestionTime)
    12.         Else
    13.     'Gives the answer a red background before loading a new question
    14.             lblAnswer(Index).BackColor = RGB(245, 45, 45)
    15.         End If
    16.        
    17.     'Disables the question time counter as the question has been answered
    18.         tmrQuestionTime.Enabled = False
    19.         tmrNewQuestion.Enabled = True
    20. 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
  •  



Click Here to Expand Forum to Full Width