?
Solved

Grid Index Out of Range

Posted on 1997-05-01
4
Medium Priority
?
2,281 Views
Last Modified: 2008-02-26
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
Comment
Question by:billmee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
javiertb earned 220 total points
ID: 1335846
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
 

Author Comment

by:billmee
ID: 1335847
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
 
LVL 2

Expert Comment

by:javiertb
ID: 1335848
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
 

Author Comment

by:billmee
ID: 1335849
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 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