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

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates and adds a column with the specified key, aligned text, width, and image key 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,
	string imageKey
)

Parameters

key
Type: System.String

The key of the column header.

text
Type: System.String

The text to display in the column header.

width
Type: System.Int32

The initial width of the column header.

textAlign
Type: System.Windows.Forms.HorizontalAlignment

One of the HorizontalAlignment values.

imageKey
Type: System.String

The key value of the image to display in the column header.

Return Value

Type: System.Windows.Forms.ColumnHeader

The ColumnHeader with the specified key, aligned text, width, and image key 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
Available since 2.0
Return to top
Show: