Solved

How to make a grid control scroll down via program.

Posted on 1998-09-29
5
182 Views
Last Modified: 2010-04-30
I am developing a screen with a grid control (not dbgrid control). I have enabled a vertical scroll bar since the number of rows is large. How do I scroll down the grid via code to make a row visible ? Is there a method for this ? I can't see any under vb help option. Thanks.
0
Comment
Question by:kkandasa
5 Comments
 
LVL 2

Expert Comment

by:dabellei
ID: 1437258
Wich grid are you using
0
 
LVL 1

Accepted Solution

by:
CarlosJac earned 50 total points
ID: 1437259
try:

SendKeys "{DOWN}"
0
 

Expert Comment

by:poodle
ID: 1437260
If you would like to scroll down slowly ( as if a user is clicking by mouse), you can put a timer control on your form. Set the timer interval property to 2500 ( 1/4 seconds ) then on the timer click event, enter following code:

If typename(screen.activecontrol) = "your Grid control name" then
    sendkeys "{DOWN}"
Else
   myGrid.Setfocus
   sendkeys "{DOWN}"
End if

NOTE: If you used dbGrid, then the part "your Grid control name" will be "dbGrid".
0
 
LVL 1

Expert Comment

by:lawnranger
ID: 1437261
To position row 20 at the top of the grid programmatically use;
Grid1.TopRow=20

If you want it part way down or something, subtract a few rows from the desired position. Ex, grid is 20 rows tall and you want to scroll to put item 112 in the middle use;
Grid1.TopRow=102
0
 

Author Comment

by:kkandasa
ID: 1437262
Thank you for your answer. I also got another answer where I can get set the toprow property to have the same effect. This site is great!!!!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
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…

776 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