Results 1 to 7 of 7

Thread: listview width resize [Resolved]

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    17

    Resolved listview width resize [Resolved]

    How would i say something like

    listview.width = (width of each columnHeader)

    to make the listview's width resize so no scrollbar is needed?

    Thanks,

    ~Neith
    Last edited by Neith; Dec 25th, 2004 at 10:13 PM. Reason: Resolved

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: listview width resize

    you have to loop through, and find the widest item, and set the width to that. search the forum, it has been done before. I'm pretty sure I saw it in a class that I downloaded that was posted yesterday. Helpful things...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    17

    Re: listview width resize

    i'm not talking about autoresizing the column headers, i've done that already. I mean autoresizing the actual listview control width to equal the combined widths of all the columns. is there no ColumnHeaders.Width?

    ~Neith

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: listview width resize

    Here is a quicky for you but kim that you'll have encounter for a vertical scrollbar (I just hardcoded 600) but that would be another issue:
    VB Code:
    1. Dim intWidth%
    2.    
    3.     With ListView1
    4.         For i = 1 To .ColumnHeaders.Count
    5.             intWidth = intWidth + .ColumnHeaders(i).Width
    6.         Next i
    7.     End With
    8.     ListView1.Width = intWidth + 600

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2004
    Posts
    17

    Re: listview width resize

    that did it, thank you!

    ~Neith

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: listview width resize

    You're very welcome.

  7. #7

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