Go Premium for a chance to win a PS4. Enter to Win

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

Nonsense error

     Hi. My problem is that I have a form where I show the user the information about the customers in a database. I have added to the form a navigator so the user can click and move in the table. But lastly, I am getting an error I don't understand. It seems that when I first show the form in the program and go to the last record by clicking the navigator's button, I get an error that says: 'Grid Index Out Of Range' ... and I don't have any grids on my form ! My surprise grows when I accept the error, close the form, open it again, go to the last record and then, I don't get the error! It's incredible, but I only get the error the first time I show the form. When I show it the second time and so on, nothing happens with that error. What is wrong with my form ? If I don't use a grid, why do I get that kind of error ?
0
sime
Asked:
sime
  • 2
1 Solution
 
javiertbCommented:
Here you have several options:

-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
0
 
javiertbCommented:
Are you going to evaluate my answer or not??
0
 
simeAuthor Commented:
Great answer, thanks for all.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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