Skip to content

ItemIndex Property

Description

Default index of the column. The index of the column within the GridControl's collection of columns.

Property Type

Read-write property

Syntax (Visual Basic)

Public Property ItemIndex() As Long

Remarks

This is the index of the column given when added to the GridControl's collection of columns. The ItemIndex starts at 0 and increments by 1 for each column in the GridControl. The ItemIndex will not change when the columns are moved (dragged and dropped to another location).

The ItemIndex is used to find and return a reference to a column. Since the Index of the column might change frequently, the ItemIndex is used when the column needs to be accessed.

Example

This sample illustrates how to use the ItemIndex to find columns not visible.

' Add this to the General code section  
Const COLUMN_NAME = 1  

' This code is placed in the Form_Load event  
Dim Column As GridColumn  

' The ItemIndex is specified when the column is added  
' COLUMN_NAME has been assigned as the ItemIndex  
Set Column = wndGridControl.Columns.Add(COLUMN_NAME, "Name", 300, True)  
Column.Visible = False  

' The Find method will allow you to access hidden columns  
Set Column = wndGridControl.Columns.Find(COLUMN_NAME)  
Column.Visible = True

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.