Results 1 to 4 of 4

Thread: Question regarding the "KeyDown Event" ?

Threaded View

  1. #1

    Thread Starter
    Junior Member rastin's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    26

    Lightbulb Question regarding the "KeyDown Event" ?

    Hi,
    As you can see from the code below, I've included this code on a form which changes the backcolor to blue every time I press the "a" key on the keyboard.
    When the key is released it changes the form color back to gray.

    My questions are;
    1. How do I make it respond only at the pressing of a capital "A" key?
    2. What code do I use to quit the program by pressing the "F10" key?
    3. What code do I use to display another form?

    Thanks,
    Rastin


    My code for QUESTION 1.
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKeyA
    Form1.BackColor = vbBlue
    End Select
    End Sub

    Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    Form1.BackColor = vbGray
    End Sub
    Last edited by rastin; Oct 17th, 2001 at 08:23 AM.

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