Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-17
2
Medium Priority
?
197 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 1600 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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

730 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