Main Page | Report this Page
.NET DotNet Forum Index  »  ADO .NET Forum  »  DataGridView Column autosize mode not working?...
Page 1 of 1    

DataGridView Column autosize mode not working?...

Author Message
Grant Schenck...
Posted: Tue Oct 06, 2009 6:34 pm
Guest
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!
--
Grant Schenck
 
Gregory A. Beamer...
Posted: Thu Oct 08, 2009 7:46 am
Guest
"Grant Schenck" <schenckg at (no spam) optonline.net> wrote in
news:#nPgxXuRKHA.4048 at (no spam) TK2MSFTNGP05.phx.gbl:

Quote:
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: at (no spam) gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Grant Schenck...
Posted: Thu Oct 08, 2009 1:57 pm
Guest
Winforms... Thanks!
--
Grant Schenck

"Gregory A. Beamer" <NoSpamMgbworld at (no spam) comcast.netNoSpamM> wrote in message
news:Xns9C9E58FA9B143gbworld at (no spam) 207.46.248.16...
Quote:
"Grant Schenck" <schenckg at (no spam) optonline.net> wrote in
news:#nPgxXuRKHA.4048 at (no spam) TK2MSFTNGP05.phx.gbl:

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: at (no spam) gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Mon Nov 30, 2009 12:34 pm