Answer» good day guys!,
i'm a noob in vb and i have this skul project. i' trying to retrieve data from my MSACCESS db to display in a form and i NEED to page them, like for example, if there are 20 items stored then my page limit is 10 so i would have 2 pages.. does anybody out there who knows about this please kindly help me? even just provide me a simple example of this paging in visual basic?do you mean you want to use the same set of controls to store different portions of the data based on the selected "page" number?yeah i guess so.. i have this 50 records and i want to display 10 records in each form ..One possible solution is to create a UserControl that will show each record- and then use the DataRepeater control to "multiply" your usercontrol.
The datarepeater control will handle the "paging" of your controls- in that the user will be able to scroll through all of them dynamically, even though the DR control only LOADS as many of your controls as necessary.
reference:
http://msdn.microsoft.com/en-us/library/aa231248(VS.60).aspx
If that isn't the effect your looking for, another solution is to use one of the data bound controls- all of these solutions eliminate the need for "paging", but of course this might be a REQUIREMENT...
If your accessing the database "raw" via ADO or DAO, then you can simply change the offset where you start loading data into controls- for example, upon loading the DB determine the number of pages by getting the number of records and dividing by the number of items per page, and then determining the starting location when loading data by multiplying the page number by the number of items per page to arrive at the starting offset to use in a call to the DB record pointer movement methods. Then just loop through for each item on the page and populate as appropriate.
|