Solved

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

Posted on 2004-10-17
2
185 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding to a VBA? 6 84
Copy a row 12 69
VB6 - Scroll Mouse wheel on Picturebox 13 95
add criteria to query in VB, Access 2003 2 30
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

749 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