How to set the size of DataGridView VB.net
Solution 1
Set the property AutoSizeColumnsMode
to be Fill
. That'll ensure your columns stretch to 100% within your DataGridView. The columns will stretch/shrink when you resize your grid (if your grid is anchored to your form).
Solution 2
Look at the Fill Weights for the Columns.
Specifically, change the AutoSizeMode
to Fill.
If trying to expand more than one column, adjust the FillWeight
percentage.
Mike George
I am currently the owner and operator of Tall Duck Web Services LLC. Specializing in Web Design, Development, and Hosting. I find StackOverflow to be a great resource when there is a need for assistance while developing and designing.
Updated on June 04, 2022Comments
-
Mike George almost 2 years
Program http://www.repairstatus.org/program.png
The DataGridView fetches the data from a MySQL server but it does not fill the entire box in size.
Ideally I would like to manually set the table size to fit the box at least width-wise because the rest will fill up once the database is populated more.