When programming the grid object, you can access only the current line in a grid through VBA. This means that grid events occur only for the current line, and you can set or return the values of fields that appear in the current line. Keep in mind that you won’t know which line in the grid is actually the current line; you must rely on the data values of the fields in the line to ascertain which line is selected. There are several ways you can use VBA to interact with a grid object in your project.
Grid events execute a procedure when the accounting system fills a grid, when the user moves to a line, changes the contents of a line or exits the line. You’ll find grid events especially useful if you want to filter the information displayed in a grid, or if you want to set or return field values in a line as the user interacts with that line. The section titled Using grid events explains each type of grid event you can use to execute VBA code.
Like windows, grids contain window fields that you can reference and manipulate through VBA. For grids whose fields are editable, window field events occur when the user moves the focus between fields in a line.
If you reference window fields in windows or grids outside the current grid, you must use a qualified field name. A qualified name explicitly specifies the location of the field you’re referencing. Refer to Programming Window Fields for more information about using window fields.
After you define a grid as an object in your project, any VBA code you write in your VBA project has full access to the grid object, its properties and its methods. You reference a grid in the same manner as a window, using the grid’s name as a qualifier for any grid fields you reference.