Results 1 to 3 of 3

Thread: DataGrid Control - AutoSize Columns

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member Mindcrime's Avatar
    Join Date
    Jun 2001
    Location
    Peterborough, UK
    Posts
    555

    DataGrid Control - AutoSize Columns

    How can I Autosize the columns in a Datagrid, so that each column is as wide as the maximum length of any data held in it?
    Mindcrime : )
    ICQ 24003332

    VB 5.0, VB 6.0 SP5, COM, DCOM, VB.NET Beta 2, Oracle 8

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    TrueDBGrid (www.componentone.com) does that (as well as many other things) very well.

    TrueDBGrid1.Columns(x).AutoSize
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3

    Thread Starter
    Fanatic Member Mindcrime's Avatar
    Join Date
    Jun 2001
    Location
    Peterborough, UK
    Posts
    555

    Another silly question!!

    I can see an advantage of being in the position where my boss would folk out for a control like that, but its for internal program

    Have got around this by doing a loop around the visible rows, populting the required column into a autosized label and reutrning the maximum length.

    Only trouble is, the record pointer moves down the grid when I move next row.

    Is there any way of locking the grid while I do this to prevent the pointer moving?

    Also, how can I select all the records without the recordselector moving? Is it bookmarks or something?
    Mindcrime : )
    ICQ 24003332

    VB 5.0, VB 6.0 SP5, COM, DCOM, VB.NET Beta 2, Oracle 8

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