Solved

How to make a grid control scroll down via program.

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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

18 Experts available now in Live!

Get 1:1 Help Now