Click here to Skip to main content
15,886,774 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
sir by your words i used 'left,top,right,bottom' attribute of Anchor property in datagridview. but during runtime the dgv control becomes extremely large insufficient to fit in a screen how i be able to view all the data. also there shows no scroll bars

What I have tried:

as sir has told i used Anchor property of dgv control and scroll property to both and dock to none but the dgv exceeds the size of the form and there are no scroll bars to be seen
what next to do ?
Posted
Updated 17-Feb-21 2:48am
Comments
Richard MacCutchan 17-Feb-21 8:46am    
You can only show the amount of data that will fit in the form, or on the screen. If there is too much to show then you need to redesign your application.
Member 12712527 18-Feb-21 0:02am    
Yes sir but what about the scroll bars
Richard MacCutchan 18-Feb-21 3:23am    
What about them?

1 solution

You probably have some other properties that conflict with the Anchor property.
Try making a fresh start with a new DataGridView, don't touch any of the other properties, only:
set Anchor to Top, Bottom, Left, Right
set Scrollbars to Both
Also don't use other containers, just drop the new DataGridView on the form.

If for some reason you can not get it working then this trick might do it:
c# - Add thousands of columns into datagridview - Stack Overflow[^]
 
Share this answer
 
v3
Comments
Member 12712527 18-Feb-21 2:17am    
thanks sir done it of-course by your example of the code that you provided...
RickZeeland 18-Feb-21 2:35am    
Congrats, then you can mark this as solved.
I'm still curious why you could not get the Anchoring working, I think this is an important concept that you should master (in the future)

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