DataGridView Column autosize mode not working?

  • Thread starter Thread starter Grant Schenck
  • Start date Start date
G

Grant Schenck

Hello,

I'm having a problem with a DataGridView header.

I have a form with a DataGridView.

In code I add a column. I set the AutoSizeMode to
DataGridViewAutoSizeColumnMode.ColumnHeader as shown here

comboBoxColumn.DataSource = dtStationList;
comboBoxColumn.DisplayMember = "Name";
comboBoxColumn.ValueMember = "StationListID";
comboBoxColumn.DataPropertyName = "StationListID";
comboBoxColumn.HeaderText = "Station List Name";
comboBoxColumn.AutoSizeMode =
DataGridViewAutoSizeColumnMode.ColumnHeader;

I end up with a header that has "Station" on the first line and "List Name"
on the second line. If I use "StationListName" as the header text then the
header is shown on one line.

So, how do I prevent the DataGridControl from putting my header on multiple
lines?

Thanks!
 
I end up with a header that has "Station" on the first line and "List
Name" on the second line. If I use "StationListName" as the header
text then the header is shown on one line.

So, how do I prevent the DataGridControl from putting my header on
multiple lines?

If you do not have enough space for the headers, it will wrap regardless
of mode.

Is this win forms or ASP.NET?

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Winforms... Thanks!
--
Grant Schenck

Gregory A. Beamer said:
If you do not have enough space for the headers, it will wrap regardless
of mode.

Is this win forms or ASP.NET?

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top