Column Resizing

  • Thread starter Thread starter Beebs
  • Start date Start date
B

Beebs

How do I, through code, resize a column in a listview, in my case, the
first one? I can't seem to find a property or method for doing this.
 
ListView has a Columns collection, each has text and width (in pixels)
properties e.g.

ListView1.Columns(0).Width = 100

Peter
 
Why if I have a column set up in the designer, then do:

lstDeptFloorRoom.Columns(0).Width = 210

I get an ArgumentOutOfRangeException? I have 1 column, yet it thinks
I don't...how could this be?
 
You can check the Columns.Count property at runtime to check what columns
you have. One thing to be aware of is that if you call
lstDeptFloorRoom.Clear() it will clear the Columns as well as the Items. To
avoid this clear your list with lstDeptFloorRoom.Items.Clear()

Peter
 
Back
Top