Export (0) Print
Expand All

ListView.ColumnHeaderCollection.Add Method (String, String, Int32, HorizontalAlignment, Int32)

Creates and adds a column with the specified key, aligned text, width, and image index to the collection.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public virtual ColumnHeader Add(
	string key,
	string text,
	int width,
	HorizontalAlignment textAlign,
	int imageIndex


Type: System.String

The key of the column header.

Type: System.String

The text to display in the column header.

Type: System.Int32

The initial width of the column header.

Type: System.Windows.Forms.HorizontalAlignment

One of the HorizontalAlignment values.

Type: System.Int32

The index value of the image to display in the column.

Return Value

Type: System.Windows.Forms.ColumnHeader
The ColumnHeader with the specified key, aligned text, width, and image index that has been added to the collection.

The Name property corresponds to the key for a column in the ListView.ColumnHeaderCollection.

The column is added at the end of the collection.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft