Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
Lots of Empty Horizontal Scroll Space
posted

I have a grid that when the window form is first loaded has a lot of horizontal scroll space on the right side of the last column.  I then click the save button that goes out to the DB to get data and sets up the grid the same way as when the form first loaded but with the new row.  This time the grid doesn't have any extra horizontal scroll space to the right of the last column.  Why would refreshing the grid with this new row make any difference.  The data is grabbed the same way and the grid is set up the same way upon loading the form as it is when any row is added. 

 One thing I've found is that I'm setting the datasource of the grid to a collection that has a lot of items in it.  I try hidding all of these items and then only showing two of the items.  Doing this gives me all of this extra horizontal space.  If I set the datasource of the grid to a datatable that contains only the two columns I want to show then I don't have the extra horizontal space.

 I've found a solution to the problem but was wondering why I had a problem when setting the datasource of the grid to the collection.  This doesn't seem like it should happen and I shouldn't need to create a new datatable to fix this problem.  Thanks for any explanation.