Adds a Column object to the collection and returns a reference to the newly created
object.
Type | Description | |||
ColumnCaption as String | A string expression that indicates the caption for the column being added |
Return | Description | |||
Variant | A Column object that indicates the newly added column. |
By default, the control contains no columns. Before adding new items, you need to add columns. Use the Add property to add new columns to the control. The control fires the AddColumn event is fired when a new columns has been added to Columns collection. Use the Caption property to change the column's caption. Use the HTLMCaption property to display the column's caption using HTML tags. To hide a column use the Visible property of the Column object. Use the AddItem, InsertItem, InsertControlItem, PutItems, DataSource properties to add new items to the control. Use the BeginUpdate and EndUpdate methods to maintain performance while adding new columns and items. Use the ConditionalFormats method to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula.
The following VB sample adds columns from a record set:
Set rs = CreateObject("ADODB.Recordset") rs.Open "Orders", "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB", 3 ' Opens the table using static mode Tree1.BeginUpdate ' Add the columns With Tree1.Columns For Each f In rs.Fields .Add f.Name Next End With Tree1.PutItems rs.getRows() Tree1.EndUpdate
The following VC sample adds a column:
#include "Columns.h" #include "Column.h" CColumns columns = m_tree.GetColumns(); CColumn column( V_DISPATCH( &columns.Add( "Column 1" ) ) ); column.SetHeaderBold( TRUE );
The following VB.NET sample adds a column:
With AxTree1.Columns With .Add("Column 1") .HeaderBold = True End With End With
The Add method returns a Column object in a VARIANT value, so you can use a code like follows:
With AxTree1.Columns Dim c As EXTREELib.Column c = .Add("Column 1") With c .HeaderBold = True End With End With
this way, you can have the properties of the column at design time when typing the '.' character.
The following C# sample adds a column:
EXTREELib.Column column = axTree1.Columns.Add( "Column 1" ) as EXTREELib.Column; column.HeaderBold = true;
The following VFP sample adds a column:
with thisform.Tree1.Columns.Add( "Column 1" ) .HeaderBold = .t. endwith