Solved

Grid Index Out of Range

Posted on 1997-05-01
4
2,222 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 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

707 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