How to search winform and use paging

Booney 166 Reputation points
2021-04-23T15:59:33.177+00:00

Can someone show example or give direction on how to search a WinForms and have a paging button .
I will search by date and could have several records for the same date so I need to page through them.
I don't have a datagridview it retrieving from a SQLITE database.

Developer technologies Windows Forms
SQL Server Other
Developer technologies C#
{count} vote

2 answers

Sort by: Most helpful
  1. Duane Arnold 3,216 Reputation points
    2021-04-24T16:39:45.513+00:00

    I don't know how you expect to do paging without some kind of Windows form control like a grid.

    https://www.codeproject.com/Articles/16303/DataGrid-Paging-C-Windows-Forms

    https://learn.microsoft.com/en-us/visualstudio/data-tools/create-a-windows-form-to-search-data?view=vs-2019

    You should be able to tie it altogether and come up with something.

    1 person found this answer helpful.
    0 comments No comments

  2. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2021-04-24T16:36:56.4+00:00

    High level something like this

    SELECT 'your colmns' FROM your table LIMIT 10 OFFSET 10;  
    

    In code you would have a variable for how many records to return e.g. pageSize then an offset, where to start with. So for instance there are 100 records, page size is 10. You would get the first 10 records then next time starting at positon 11 and get next ten records etc.

     $"SELECT 'your colmns' FROM your table LIMIT {pageSize} OFFSET {offset};";  
    

    Just coded something very similar last night for a C#8 features, might give you ideas.

    Anytime I've needed pagination it's been with a 3rd product so nothing to show code-wise.

    ---

    90990-kpmvp.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.