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.

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,811 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,482 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,097 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Duane Arnold 3,211 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,016 Reputation points
    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