Search code examples
vb.netdatagridview

User can't resize DataGridView columns


I have a DataGridView with the datasource set to a binding source of data. My problem is I cannot get most of the columns to resize. Several of the columns don't show a resize cursor, while two others do: one can be resized, one cannot.

Here is what I have tried:

  • DGV.AllowUsertoResizeColumns = True
  • DGV.AutoSizeColumnMode = None
  • DGV.RowHeadersWidthSizeMode = EnableResizing
  • DGV.Dock = Fill
  • All Columns having AutoSizeMode = NoneSet and Resizable = True
  • The DGV is embedded in a panel of a SplitContainer, yet after bringing it to front, the others to back, or other random combinations, still unable to resize
  • Using dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader) (and other variations) after data has been loaded into the DGV
  • While I'm able to resize one of the columns, the settings in the Columns collection are no different from the others

Here's a screenshot of the properties of my DataGridView:

DataGridView Properties

Any Ideas?


Solution

  • Upon checking the individual column settings in the gridview, I found some cells still had

    AutoSizeMode = AllCells

    I changed this to:

    AutoSizeMode = NotSet

    and now I am able to resize all columns.