Solved

How to make a grid control scroll down via program.

Posted on 1998-09-29
5
194 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
[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
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

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…
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.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 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