Fixed records in display in datagridview

rahul kumar 605 Reputation points
2023-10-06T21:47:05.86+00:00

is there a way be which we can enforce a datagridview which is although having 1000 records in it , to initially show only 30 records on form page load (the very first time the form loads) .for the balance 970, it should have no scroll bar for the balance of records .

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,873 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,648 questions
{count} votes

2 answers

Sort by: Most helpful
  1. KOZ6.0 6,300 Reputation points
    2023-10-06T22:06:06.03+00:00
    0 comments No comments

  2. Jiale Xue - MSFT 43,046 Reputation points Microsoft Vendor
    2023-10-09T09:21:20.8166667+00:00

    Hi @Rahul Kumar , Welcome to Microsoft Q&A,

    How do you assign your own data to the datagridview?

    An easy way is to only assign 30 rows of data and cancel the ScrollBars.

    dataGridView1.ScrollBars = ScrollBars.None;
    

    Enter all the inputs again when you need them, and then set the ScrollBars.

    
    dataGridView1.ScrollBars = ScrollBars.Vertical;
    
    

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments