Results 1 to 4 of 4

Thread: [2005] DataGridView header problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    396

    [2005] DataGridView header problem

    Hi All;

    I am using the datagridview to display information from a database table.

    I use the following code to set the header and then set the column size...

    Code:
    DataGridView1.Columns("ORDER_NBR").HeaderCell.Value = "Order Number"
    DataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
    In the grid column I see

    Order
    Number


    instead of

    Order Number

    Does anyone know why this is happening?

    Thanks
    Lin

  2. #2
    Fanatic Member Clanguage's Avatar
    Join Date
    Jan 2008
    Location
    North Carolina
    Posts
    659

    Re: [2005] DataGridView header problem

    I think that you need to set the WrapMode of the columnHeadersDefaultCellStyle to false.
    CLanguage;
    IF Post = HelpFull Then
    RateMe
    Else
    Say("Shut UP")
    End If
    DotNet rocks
    VB 6, VB.Net 2003, 2005, 2008, 2010, SQL 2005, WM 5.0,ahem ?OpenRoad?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    396

    Re: [2005] DataGridView header problem

    Hi Clanguage;

    Your suggestion works but I thought that

    Code:
    DataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnMode.AllCells)
    was supposed to handle it

  4. #4
    Fanatic Member Clanguage's Avatar
    Join Date
    Jan 2008
    Location
    North Carolina
    Posts
    659

    Re: [2005] DataGridView header problem

    That would work for the columns not the Column Header I believe.
    CLanguage;
    IF Post = HelpFull Then
    RateMe
    Else
    Say("Shut UP")
    End If
    DotNet rocks
    VB 6, VB.Net 2003, 2005, 2008, 2010, SQL 2005, WM 5.0,ahem ?OpenRoad?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width