Solved

How to make a grid control scroll down via program.

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

919 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now