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
Solved

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

Posted on 2004-10-17
2
183 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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
MsgBox 2 59
VBA: Insert New column with specific format type 12 38
VBA: loop recent folder and copy txt file. 8 33
transition to visual .net from vb6 5 36
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 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