Click here to Skip to main content
15,746,883 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a datagridview including 100 columns and 10,000 rows
now how will it fit into datagridview so that if scroll bars are dragged to extreme side
one could see all the figures . whether it's vertical scroll bar or horizontal scroll bar

What I have tried:

i am stuck in the regarding matter and could not go further. i have used
dgv.HorizontalScrollingOffset = dgv.Width;
but not very useful
Updated 16-Feb-21 0:40am
Richard Deeming 16-Feb-21 5:24am    
Do you seriously expect anyone to scroll through that many rows?

If your users could review one row per second, it would take them 2 hours and 47 minutes to review that much data.

Find a way to reduce the amount of data they have to view. Give them searching options, or summarize the data somehow.

Don't even think about it. It's be incredibly slow to load, it's look like cack, and it'll be impossible for your users to use.

How long do you think it would take you to find the one row you are interested in out of 10,000? How far are they going to scroll 100 columns?
Answer: they won't. They'll take one look at your app, and uninstall it. Then demand their money back - I would.

Never preset a user with more than 100 rows at most: provide filters, searches, paging - just like google does when you search it: it says "I found 5,000,000 relevant item,s - here's the top 20", and when did you last even look at page 2, let alone 2000?

Just because it's simple for you to implement, doesn't mean it's the right thing to do!
Share this answer
Member 12712527 16-Feb-21 7:34am    
i am saying once the database is delivered the user may insert such heavy records in it
so if he wants to scroll through the records maybe not 100 columns but if there are 20 or 30 columns and not 10,000 rows less as 100 or 50 rows then seeing all at once would be impossible . in such case how he will view all the items of the records
Member 12712527 16-Feb-21 8:15am    
okay sir done it
In addition to the good advice offered by fellow CodeProjectors, make sure to:

Set Anchor property to: Top, Bottom, Left, Right
Set Scrollbars property to: Both

Also take a look at: Walkthrough: Implement virtual mode in DataGridView control - Windows Forms .NET Framework | Microsoft Docs[^]
And: c# - implementing virtual mode for a datagridview that is databound - Stack Overflow[^]
And: c# - Slow performance in populating DataGridView with large data - Stack Overflow[^]
Share this answer
Member 12712527 16-Feb-21 8:16am    
not that but the dock property
RickZeeland 16-Feb-21 8:33am    
Dock can sometimes be problematic, try to turn it off and use Anchor instead.
Member 12712527 17-Feb-21 2:54am    
sir by using Anchor property the form becomes incredibly large which doesn't fit on the screen
RickZeeland 17-Feb-21 3:20am    
That should not be the case, check if you did not set some other properties wrong.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900