property Columns.Item (Index as Variant) as Column

Returns a specific Column of the Columns collection.

 TypeDescription 
   Index as Variant A long expression that indicates the column's index or a string expression that indicates the column's key or the column's caption.  
   Column A column object being returned.  

Use the Item property to access to a specific column.  The Count property counts the columns in the control. Use the Columns property to access the control's Columns collection.

The Item property is the default property of the Columns object so the following statements are equivalents:

Tree1.Columns.Item ("Freight")
Tree1.Columns ("Freight")

The following VB sample enumerates the columns in the control:

For i = 0 To Tree1.Columns.Count - 1
    Debug.Print Tree1.Columns(i).Caption
Next

The following VC sample enumerates the columns in the control:

#include "Columns.h"
#include "Column.h"
CColumns columns = m_tree.GetColumns();
for ( long i = 0; i < columns.GetCount(); i++ )
{
	CColumn column = columns.GetItem( COleVariant( i ) );
	OutputDebugString( column.GetCaption() );
}

The following VB.NET sample enumerates the columns in the control:

With AxTree1.Columns
    Dim i As Integer
    For i = 0 To .Count - 1
        Debug.WriteLine(.Item(i).Caption)
    Next
End With

The following C# sample enumerates the columns in the control:

EXTREELib.Columns columns =axTree1.Columns;
for ( int i = 0; i < columns.Count; i++ )
{
	EXTREELib.Column column = columns[i];
	System.Diagnostics.Debug.WriteLine( column.Caption );
}

The following VFP sample enumerates the columns in the control:

with thisform.Tree1.Columns
	for i = 0 to .Count - 1
		wait window nowait .Item(i).Caption
	next
endwith

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.