Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual FoxPro
Expertise: Beginner
Jan 21, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Grid Object Methods and Properties


I have opened a table as a grid object. I want to go to a desired column (say 34) and the table has 62 fields. Currently only columns 1 through 10 are visible.

How can I accomplish this?


There is one method and two properties of grid objects that apply to what you are trying to accomplish: ActivateCell, ActiveRow, and ActiveColumn. Grids have a method called ActivateCell, where you can pass a row number and a column number to set focus to a particular cell in the grid, whether it is visible or not. ActiveRow is the current row in the grid and ActiveColumn is the current column in the grid.

So if you wanted to activate the 34th field (column) in the current row of the grid, you would execute the following:


The tricky part about using ActiveRow and ActiveColumn is that they only have a value when the grid has focus; otherwise they are 0. Therefore, you need to add the following line before the ActivateCell call:


This gives the grid focus and therefore shows correct values in the ActiveRow and ActiveColumn properties.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date