Logo
Home Cart [Log In] About Us Contact Us

Object Reference

xf_DataListDataList Base Class

Public Function GetColIndexFromColNameOrIndex (
ColNameOrIntIndex As Variant,
Optional SuppressError As Boolean = True,
Optional ColInterpretation As xf_ColInterpretationEnum = xf_ColInterpretation_FirstAsIndex
) As Integer

Get a column index from a column index or name
- if the passed value is an integer, it is treated as a column index
- if the passed value is a string and ColInterpretation=xf_ColInterpretation_FirstAsName, it is treated as a column name always (even if it is numeric)
- if the passed value is a string and ColInterpretation=xf_ColInterpretation_FirstAsIndex , the value is treated as a column index if the string can be converted to an integer, or as a column name otherwise

ColNameOrIntIndex as Variant

The column index (1 ... ColCount) or name. An integer will always be treated as a column index. A string which can be converted to an integer may be treated as a column index, depending on the value of ColInterpretation.

Optional SuppressError as Boolean = True

Do not display an error message if the row or column index are out of range, just return Null.

Optional ColInterpretation as xf_ColInterpretationEnum = xf_ColInterpretation_FirstAsIndex

if xf_ColInterpretation_FirstAsIndex, interpret ColNameOrIntIndex as an index if it can be converted to an integer, even if it is passed as a string if xf_ColInterpretation_FirstAsName, always interpret ColNameOrIntIndex as name if it is a passed as a string

Call Template:

Dim obj As New xf_DataList
Dim i As Integer
i = obj.GetColIndexFromColNameOrIndex(ColNameOrIntIndex)
i = obj.GetColIndexFromColNameOrIndex(ColNameOrIntIndex, SuppressError, ColInterpretation)

See Also:

Example 1:

Debug.Print lst.GetColIndexFromColNameOrIndex(4)              -> 4
Debug.Print lst.GetColIndexFromColNameOrIndex("CategoryID")   -> 2
Contact Us :: About Us :: Policies :: email: infspamo@arrospamw-of-tispamme.com    © 2012 Arrow Of Time Pty Ltd