Function Array Conversions Class

VariantVectorToMatrixRow

Overlays a one-dimensional Variant array onto a Row of a two-dimensional Variant array. The destination array must already have been dimensioned.

Signature (Visual Basic / VBA)

Public Function VariantVectorToMatrixRow( _
      ByRef rTo() As Variant _
    , ByRef vFm() As Variant _
    , ByVal vRowNumber As Variant _
    ) As Boolean

Code Examples

    Assuming
       Static avarTable(0 To 2, 0 To 2) As Variant
       ' Column--v  v--Row
       avarTable(1, 1) = "From"
       avarTable(2, 1) = "feet"
       avarTable(1, 2) = "To"
       avarTable(2, 2) = "meters"
       Static avarNew(1 To 2) As Variant
       avarNew(1) = "To"
       avarNew(2) = "yards"
    for example
       ? VariantVectorToMatrixRow(avarTable(), avarNew(), 2)
       True
       ? VariantMatrixToString(avarTable(), " ", vbCrLf)
       From feet
       To yards
    rTo(X, RowNumber) = vFm(X)

Parameters

Parameter Description
rTo Two-dimensional array of Variants in which one of the rows will be overlaid by vFm. Within this array, dimension #1 represents the Column and dimension #2 represents the Row. This is because the number of rows changes most frequently and the upper bound of the last dimension (representing the row) can be re-dimensioned directly by Visual Basic.
vFm One-dimensional Variant array containing the values that will replace the row in rTo.
vRowNumber Number of the Row in rTo whose values will be replaced.

Return Value

Function does nothing and returns False if vRowNumber is Null or cannot be fixed-up to a number. Function currently returns True in all other cases.