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
Solved

Grid Index Out of Range

Posted on 1997-05-01
4
2,122 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
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
javiertb earned 110 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 161
SUM 2 INTEGER ARRAYS INTO 1 10 108
Base1 Encode/Decode 3 81
Why is there a Difference between the SQL String and using the Parameter ? 7 44
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

791 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