Results 1 to 5 of 5

Thread: [RESOLVED] [2005] ListView Column Headers Question

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Resolved [RESOLVED] [2005] ListView Column Headers Question

    I would like to know if it is possible if the columns of the listview can be resized automatically based on the information in the listview?

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [2005] ListView Column Headers Question

    If am not sure if there is an automatic way of doing this, but when you are finished populating the ListView, you could loop through each of the columns, then using TextRenderer.MeasureText find out the length of the longest string and then set the Width of the Column.

    Hope that helps!!

    Gary

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] ListView Column Headers Question

    Once again, reading the MSDN documentation is all it would take to answer this question. Looking at the member listing for the ListView class, the AutoResizeColumns method is the fifth member in the list.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [2005] ListView Column Headers Question

    oops, I did have a quick skim through the documentation, but I must have missed that one.

    Sorry about that!!

    Gary

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [2005] ListView Column Headers Question

    i went to the MSDN and i missed it too. thanks all.

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