PC Review


Reply
Thread Tools Rate Thread

DataGridView Column autosize mode not working?

 
 
Grant Schenck
Guest
Posts: n/a
 
      7th Oct 2009
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


 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      8th Oct 2009
"Grant Schenck" <(E-Mail Removed)> wrote in
news:#(E-Mail Removed):

> 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! |
*******************************************
 
Reply With Quote
 
 
 
 
Grant Schenck
Guest
Posts: n/a
 
      8th Oct 2009
Winforms... Thanks!
--
Grant Schenck

"Gregory A. Beamer" <(E-Mail Removed)> wrote in message
news:Xns9C9E58FA9B143gbworld@207.46.248.16...
> "Grant Schenck" <(E-Mail Removed)> wrote in
> news:#(E-Mail Removed):
>
>> 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! |
> *******************************************



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Crashes in Normal Mode, Safe Mode With Networking mode butnot Safe Mode bhoi Windows XP Help 0 15th Aug 2011 10:05 PM
Listview Column Header AutoSize & column sorting Ed Kramer Microsoft C# .NET 1 29th Aug 2008 11:02 PM
Autosize datagrid column =?Utf-8?B?QWRuYW4=?= Microsoft Dot NET Compact Framework 0 15th Dec 2004 06:57 AM
Autosize the column width Jim Coyne Microsoft Excel Programming 5 21st May 2004 05:50 AM
Listview Column Header Autosize Bug ? Cybertof Microsoft C# .NET 1 28th Oct 2003 05:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:32 AM.