A collection of all the columns in the specified control. Each column is represented by a Column object.


Use the Columns property to return a reference to the Columns collection. The following example sets the width of all columns to 100 pixels.

For Each $Column In $ListView.Columns $Column.Width = 100 Next

Use Columns(index), where index is the column index number, to return a single Column object from the collection. The following example sets the heading text in column one to a new value.

$ListView.Columns(1).Text = "Name"

Columns are indexed from left to right in the control. Columns(0) is the leftmost column, and Columns(Columns.Count-1) is the rightmost column. The following example removes the last column in the control.

$ListView.Columns.Remove($ListView.Columns.Count - 1)

Use the Add method to create a new Column and add it to the collection. The following example creates a new column labeled "Amount" that is 100 pixels wide and right aligned.

$Column = $ListView.Columns.Add("Amount",100,1)

If you want to insert a column at a specific location, use the Insert method. To remove a column from the collection, use the Remove method. The Clear method allows you to remove all columns from the collection instead of using the Remove method to remove a single column at a time.

The CHM file was converted to HTML by chm2web software.