Solved

using page up and page down and the up and dow arrow keys

Posted on 2004-10-17
2
188 Views
Last Modified: 2010-05-02
My form has become so long that I am using VScroll bars to see all the text boxes which needed to be filled in. However as an added functionality I need to give the functionality of using the page up and page down geys to scroll the form or the arrow keys. How can I do that
0
Comment
Question by:anshuma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 400 total points
ID: 12333309
Set the form keypreview property to true.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
Select Case KeyCode
    Case vbKeyPageDown
        VScroll1.Value = VScroll1.Max   'move to bottom of form
    Case vbKeyPageUp
        VScroll1.Value = VScroll1.Min    'move to top of form
    Case vbKeyDown
        VScroll1.Value = VScroll1.Value + 315    'you can adjust the speed by changing this number
    Case vbKeyUp
        VScroll1.Value = VScroll1.Value - 315     'you can adjust the speed by changing this number
End Select
End Sub

S
0
 
LVL 9

Assisted Solution

by:Shahid Thaika
Shahid Thaika earned 100 total points
ID: 12333313
Doesn't the scroll bar control support the use of arrow keys. Anyway you can add the following event and code to do the scrolling in your form...


Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
    Case vbKeyPageUp
        'scroll up
       
    Case vbKeyPageDown
        'scroll down
       
    Case vbKeyUp
   
    Case vbKeyDown
   
End Select
End Sub


Make sure 'KeyPreview' property of your form is set to true. Hope this answers your question :)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question