[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2422
  • Last Modified:

Grid Index Out of Range

We are getting a Grid Index out of Range error when scrolling through the records (every record) in a TwwDBGrid component.

Has anyone ever encountered this error?

What is being tested here to determine the out of range state ?  

We are using a master/detail table arrangement and displaying the detail records in the grid associated with the link field in the Master Table.

We are using Infopower's TwwDBGrid component.  This is a great component except when the above described nonsense occurs.  Naturally, nobody has any idea of what causes this problem.  We would like to figure out what we have to do either to some property (unknown) in the TDBGrid or our database structure to correct the problem.  

0
billmee
Asked:
billmee
  • 2
  • 2
1 Solution
 
javiertbCommented:
It seems to be one of those Delphi bugs, but here you have several options which may help you:

-Do not link at definition time more than one form to the same DataSet.

-Before making that call to the last record, set the datasource
Enabled property to false, then set it to True after calling Last record. If you're looping through several records at a time, set the Enabled property prior to entering the loop and reset it after leaving the loop.

-If you have hidden grids (for example on other tab pages) you may get the error when the database gets to the end. The easiest way to avoid the error is to use the onshow events of the tab pages or forms to enable the grid and the onhide event to disable the grid, this way the error doesn't seem to happen.

Hope this helps
1
 
billmeeAuthor Commented:
Perhaps I need to provide you with some more information and vice versa before I can evaluate your response to my question.

On a DBGrid component tied to a datasource which in turn is linked to a Detail Table the display of records in the grid field is completely automatic.  The Master TTable component contains the field linkage between itself and the detail component.  On form activate we initiate a query which refreshs the records displayed in the detail table.  There is no onScroll event associated with the DBGrid component. The scrolling of the displayed records is handled automatically by the component so we have no programmatic control over the display of the records in the DBGrid. The collection of records is in fact displayed.  It is just when one clicks the scroll bar arrow that the Grid Index Out of Range error pops up.

The DBGrid is on the main form and is not resident on a tabbed notebook page.
0
 
javiertbCommented:
Make sure you have no other DataSource associated to the same dataset when you access this DBGrid. If so, set it by DataSource.DisableControls.
If still isn't working, maybe the problem is on the TwwDBGrid, as I've been talking with people about the same bug, and all of them  got to solve it by doing what I told you.


0
 
billmeeAuthor Commented:
Javier,

Thankyou for your time and your thoughtful response.  I am going to make certain that the table in question is not being accessed by any other datasource on another form.

Bill Mee
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now