Sunday, October 19, 2008

Auto Fit Columns in a DataGridView

I have posted a function to auto-fit the columns in a ListView before. However, when I wanted to do the same thing for a DataGridView, the task is a little different (yet easier):


DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells

3 comments:

Anonymous said...

thanks, man.

John Load said...

Thanks. Easy and simple.

Anonymous said...

Just what I was looking for. Thanks!