How do I "autosize" a form?
-
I have a simple form containing only a DataGridView control. I would like the form to grow or shrink to fit the contents of the DataGridView. Of course the DataGridView would also need to grow and shrink to fit it's contents. Any suggestions?
-
I have a simple form containing only a DataGridView control. I would like the form to grow or shrink to fit the contents of the DataGridView. Of course the DataGridView would also need to grow and shrink to fit it's contents. Any suggestions?
If you set the anchor property of the grid, then you can just set your form's size, and the grid will follow. Measuring how big it should be is a little more complex, but you can ask the data source for a row count, as a starting point.
Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert