property Column.Position as Long
Retrieves or sets a value that indicates the position of the column in the header bar area.

 TypeDescription 
   Long A long expression that indicates the position of the column in the header bar area  

The column's index is not the same with the column's position. The Index property of Column cannot be changed by the user. Use the Position property to change the column's position. The EnsureVisibleColumn method ensures that a given column fits the control's client area. Use the Visible property to hide a column. Use the Width property to specify the column's width.

The following VB6 sample enumerates the visible columns as they are displayed:

Private Sub enumColumns(ByVal g As EXGRIDLibCtl.Grid)
    Dim cArray() As EXGRIDLibCtl.Column
    With g
        ReDim Preserve cArray(.Columns.Count)
        For Each c In .Columns
            If (c.Visible) Then
                Set cArray(c.Position) = c
            End If
        Next
    End With
    For Each c In cArray
        If Not c Is Nothing Then
            Debug.Print c.Caption & "(" & c.Index & ")"
        End If
    Next
End Sub

 


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