Grid Object Methods and Properties

Grid Object Methods and Properties

Question:

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?

Answer:

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:

thisform.oGrid.ActivateCell(thisform.oGrid.ActiveRow,34)

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:

thisform.oGrid.SetFocus()

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

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular