The General idea is that when I select a supplier from the list using the combo box located in the top left hand corner, a search is performed and the boxes underneath are filled with the information from the database. But they should only be filled in this case with items and only 8 items at a time will need to be filled.
So i need to program it in a way where it will stop after the first 8 and when the NEXT BATCH button is pressed the next 8 items from that supplier are filled in, clearing the previous set.
I'm not sure how you are accessing the database, but by having this variable it is easy to get each 'batch'. What you need is to be able to select which item numbers you want to get out of your database. Normally (with SQL for example), you tell the database the record to start at, and the record to end at, and it selects all the records between those two (including the start and end.)
Now you know you only want 8 items per page. So the difference between each start and end number needs to be 8. So if you're 'starting number' was 0, and your 'end number' was 8, it would select records 0-8.
So you'll need two more variables, lowerLimit and upperLimit. Whenever the next batch button is pressed, you need to: - Increase the 'batchNumber' by one. - Make 'lowerLimit' equal to batchNumber * 8. - Make 'upperLimit' equal to (batchNumber + 1) * 8.
Then you can just do something like this (this is SQL): SELECT * FROM your_table LIMIT lowerLimit, upperLimit.
Edit: Similarly, for previous batch, all you need to do is recude 'batchNumber' by one, and then evaluate lowerLimit and upperLimit again.
I hope this has helped.
are you using j-creator?
Lemme see, Topic Title: Database in Visual Basic, so taking a wild guess based on the topic title, I'll just assume that I am using Visual Basic. And I did not mention anything about it being a java program either.